Thema: Delphi DWM Shadow

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

DWM Shadow

  Alt 18. Mär 2017, 15:45
Ich hab ne Funktion für DWM Shadow erstellt aber der Schatten wird nicht gezeichnet.
woran liegst?

Schatten wird erstellt nach der Anzeige des Window.
Delphi-Quellcode:
// Window Anzeigen
SKAERO_ShowMainWindow(gp.hMain, 5);
SKAERO_EnableShadow(gp.hMain);
WindowStyle
dwStyle := WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN;
Delphi-Quellcode:
function DWM_ExtendFrameIntoClientArea(hWnd: hWnd; ATopHeight, ALeftWidth, ABottomHeight,
  ARightWidth: Integer): HRESULT;
var
  Margins: TMargins;
begin
  Margins.cyTopHeight := ATopHeight;
  Margins.cyBottomHeight := ABottomHeight;
  Margins.cxLeftWidth := ALeftWidth;
  Margins.cxRightWidth := ARightWidth;
  Result := S_FALSE;

  if IsDWMloaded then
    Result := DwmExtendFrameIntoClientArea(hWnd, @Margins);
end;
Delphi-Quellcode:
function TSkinEngine.EnableShadow(WinHandle: hWnd): HRESULT;
var
  val: TDWMNCRENDERINGPOLICY;
begin

  Result := -1;
  if IsCompositionEnabled then
  begin
    val := DWMNCRP_ENABLED;
    DwmSetWindowAttribute(WinHandle, DWMWA_NCRENDERING_POLICY, @val, DWMWA_ALLOW_NCPAINT);

    Result := DWM_ExtendFrameIntoClientArea(WinHandle, -1, -1, -1, -1); // result := 0 sollte also in Ordnung sein.
  end;
end;
gruss
  Mit Zitat antworten Zitat