Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Problem mit Deskbar Transparenz (https://www.delphipraxis.net/149152-problem-mit-deskbar-transparenz.html)

Shark99 15. Mär 2010 15:40


Problem mit Deskbar Transparenz
 
Dieser TransparenzCode funktioniert in einem "normalen Fenster":

Delphi-Quellcode:
procedure TMyForm.FormPaint(Sender: TObject);
var
  ReBar32Wnd: HWND;
  DC: HDC;
begin
  ReBar32Wnd := FindWindowEx(FindWindow('Shell_TrayWnd', nil ), 0, 'ReBarWindow32', nil );

  if (ReBar32Wnd <> 0) then
  begin
    DC := GetDC(ReBar32Wnd);

    StretchBlt(Canvas.Handle,
      0, 0, Width, Height,
      DC,
      0, Top, 1, Height,
      SRCCOPY);

    ReleaseDC(ReBar32Wnd, DC);
  end;
end;
In einer Deskbar für IE 7/8 funktioniert es leider nicht. Anstatt Transparent, wird die Form schwarz.

ReBar32Wnd wird gefunden (Handle ist > 0).

Ich hoffe jemand kann helfen. Danke im Voraus!

Shark99 11. Apr 2010 10:06

Re: Problem mit Deskbar Transparenz
 
Habe nach langen suchen einen anderen Lösungsansatz versucht:

Delphi-Quellcode:
procedure TMyComForm.FormPaint(Sender: TObject);
var
  rect: TRect;
  MyHDC: hDC;
begin

  if IsThemeActive then
  begin
    rect.Left  := 0;
    rect.Top   := Height - 2;
    rect.Right := Width;
    rect.Bottom := Height;
    MyHDC        := GetDC(Handle);
    if MyHDC <> 0 then
    begin
      try
        DrawThemeParentBackground(Handle, MyHDC, @rect);
      finally
        ReleaseDC(Handle,MyHDC);
      end;
    end;
  end;
end;
Leider funktioniert es immer noch nicht. Der Hintergrund des Bandes bleibt immer noch grau (WindowsXP Look). Durch debuggen weiss ich dass IsThemeActive() True liefert und myHDC <> 0 ist.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz