Registriert seit: 17. Aug 2002
178 Beiträge
|
Re: Die StatusBar und Windows XP
14. Dez 2003, 00:17
So wird die StatusBar unter XP richtig dargestellt:
Die benötigten Units gibt's bei http://www.delphi-gems.com
Delphi-Quellcode:
unit XPStatusBar;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ComCtrls;
type
TXPStatusBar = class(TStatusBar)
private
{ Private declarations }
procedure WMEraseBkgnd ( var Message : TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMSize ( var Message : TWMSize); message WM_SIZE;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
uses
ThemeSrv, TMSchema, UxTheme;
procedure Register;
begin
RegisterComponents(' Samples', [TXPStatusBar]);
end;
procedure TXPStatusBar.WMSize ( var Message : TWMSize);
begin
inherited;
Invalidate;
end;
procedure TXPStatusBar.WMEraseBkgnd ( var Message : TWMEraseBkgnD);
var
hhTheme : HTHEME;
DrawRect : TRect;
begin
hhTheme:= 0;
if ThemeServices.ThemesEnabled and not (csDesigning in ComponentState) then
hhTheme:= OpenThemeData(0,' Status');
if (hhTheme <> 0) then
try
DrawRect:= ClientRect;
DrawThemeBackground(hhTheme, Message.DC, 0, 0, DrawRect, nil);
finally
CloseThemeData(hhTheme);
Message.Result:= 1;
end else
inherited;
end;
|
|
Zitat
|