PropertyPage background color

Add-in Express™ Support Service
That's what is more important than anything else

PropertyPage background color
 
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
Posted 17 Jun, 2005 22:51:43 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
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.
Posted 18 Jun, 2005 08:12:33 Top
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)
Posted 21 Jun, 2005 19:52:52 Top
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;

Posted 21 Jun, 2005 19:55:39 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Jason,

You can find the example here.
Posted 22 Jun, 2005 06:44:19 Top