Jason Coley
Posts: 272
Joined: 2005-05-26
|
Is there anyway the background color can theme like the background of the outlook (windows) property pages. The color of the pages that I add now are btnface, whereas the color of the pages that are themed, well are all sorts of colors depending on the theme.
Jason |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Jason,
Unfortunately I don't know how to enable XP theming for DLLs created by Delphi. Sometime ago we have tried to find out a way to do this and we haven't found a solution.
|
|
Jason Coley
Posts: 272
Joined: 2005-05-26
|
well, could you make a subclass of TActiveForm and have a background paint override, then add the theme code to that?
OpenThemeData: function(hwnd: HWND; pszClassList: LPCWSTR): HTHEME; stdcall;
DrawThemeBackground: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const Rect: TRect; pClipRect: PRect): HRESULT; stdcall;
CloseThemeData: function(hTheme: HTHEME): HRESULT; stdcall;
DrawThemeBackground(TAB_THEME, B.Canvas.Handle, TABP_BODY, 0, R, nil)
|
|
Jason Coley
Posts: 272
Joined: 2005-05-26
|
const
UXTHEME_DLL = 'uxtheme.dll';
var
DllHandle: THandle;
function InitXPThemes: Boolean;
begin
if DllHandle = 0 then
begin
DllHandle := LoadLibrary(UXTHEME_DLL);
if DllHandle > 0 then
begin
OpenThemeData := GetProcAddress(DllHandle, 'OpenThemeData');
CloseThemeData := GetProcAddress(DllHandle, 'CloseThemeData');
DrawThemeBackground := GetProcAddress(DllHandle, 'DrawThemeBackground');
end;
end;
Result := DllHandle > 0;
end;
procedure FreeXPThemes;
begin
if DllHandle <> 0 then
begin
FreeLibrary(DllHandle);
DllHandle := 0;
OpenThemeData := nil;
CloseThemeData := nil;
DrawThemeBackground := nil;
end;
end;
function CanUseXPThemes: Boolean;
begin
Result := (DllHandle > 0) and IsAppThemed and IsThemeActive;
end;
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
|