Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #11  
Old 07-17-2009, 04:31 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

I know That is why I told him to ignore it. I was sleepy when I post it
Reply With Quote
  #12  
Old 07-17-2009, 04:48 PM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

lol it seems we all posted just 1 second apart!
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
  #13  
Old 07-17-2009, 04:57 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

The following procedure should do the entire job for you without knowing the names of the VCL components:

Code:
procedure SetTheme(oForm : TForm; bActivateTheme : Boolean = True);
var
          i : Integer;
begin
          for i:=0 to oForm.ComponentCount-1 do begin
              if oForm.Components[i] is TLabel then
                 continue;

              if bActivateTheme then
                 SetWindowTheme(TButton(oForm.Components[i]).Handle, nil, nil)
              else
                 SetWindowTheme(TButton(oForm.Components[i]).Handle, nil, '');

            //  TButton(oForm.Components[i]).Repaint;
          end;

          if bActivateTheme then
             SetWindowTheme(oForm.Handle, nil, nil)
          else
             SetWindowTheme(oForm.Handle, nil, '');

        //  oForm.Invalidate;
end;


//Example:
SetTheme(self,True);
Reply With Quote
  #14  
Old 07-17-2009, 05:02 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

There is one small problem with it. TBitBtn does not work with this procedure. I think because it is not really a Windows native component. Any work a round for this problem?
Reply With Quote
  #15  
Old 07-17-2009, 08:10 PM
nester261 nester261 is offline
Moderator
 
Join Date: Jan 2004
Location: UK
Posts: 618
Default

Hi,

I have found something that "may" help with this but it is probably not the way you want to go with it.

There is a suite of 3 classes written by Soft-Gems that can subclass the TBitBtn control so that it could then be themed. I use Delphi 2007 though and cannot get this control to work to be able to test it

link:
http://www.soft-gems.net/index.php?o...d=17&Itemid=33
__________________
"Where there's a will, there's always a way."

-- The Hon Robert Nester Marley O.M. - aka Bob Marley!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:00 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.