[DUG] XP / Vista Themes

Rohit Gupta rohit at cfl.co.nz
Mon Apr 16 08:25:01 NZST 2007


I havent attacked this problem yet as there many more I have to sort 
out.   For example if a control is moved after creation, it tends to not 
show.  I did expect to have to put a panel on the tabs so that the 
colours would match the rest of the panels.  Since we always used 
descended components, its not much of a hassle to fix.

John Bird wrote:
> This interests me too - there are a number of components where there are no
> properties to control the background colour etc.  The XP manifest turns page
> controls to a white background.   Personally I fiddled then just gave in and
> used it as is - so now my page controls are white.  
>
> There is a lot that can be done with careful matching of colours in the
> standard VCL - here are a couple I use:
>
> 1 - I have a list box where I turn the border off and set the background
> colour to clBtnFace - it gives a neat area of the screen with no borders
> that can scroll (The scroll bar still shows -it's the only cue that the area
> can be scrolled).
>
> 	Listbox1.borderstyle:=bsNone;
> 	listbox1.color:=clBtnFace;
>
>
> 2 - Another trick is having a page control under program control - hiding
> the borders and tabs and changing the current tab programmatically, for
> instance with a menu or button click, which gives multiple layouts on the
> same form.
>
> procedure TForm1.HideTabsInPageCtrl;
> Var
> iPage: Integer;
> begin
>   // hide the tabs
>   for iPage := 0 to PageControl1.PageCount - 1 do
>     PageControl1.Pages[iPage].TabVisible := False;
>   // set the active tabsheet
>   if (PageControl1.PageCount > 0) then
>     PageControl1.ActivePage := PageControl1.Pages[0];		//this can
> be altered later in the program
>   // hide the border of the pagecontrol
>   PageControl1.Style := tsButtons;
> end;
>
> This also does put the page control back into clBtnFace - I haven't found
> another way yet :)
>
>
> 3 - TButton   This standard control I am surprised at how little there is to
> alter - I have a version from Delphi About.Com (ColorButton) that I modified
> further to give full control over text and background colour on a button,
> with optional changes in both when the mouse goes over the button.  I also
> added a split level background colour, so that the lower half is
> automatically drawn a bit darker than the top half on mouse-over - this is
> similar to how tabs and buttons are rendered in lots of software these days,
> eg look at the Firefox and IE7 tabs.  Also optionally the text font gets
> bolded on Mouse over.  I think this is quite like the trend in Vista etc
> where effectively buttons are becoming quite large (eg in the new dialogs
> with a large amount of text in them), and often do reflect a change in
> appearance on mouse over...I had this working on D5 and D2006 so I suspect
> it's a component that will travel easily to later versions too...  The
> standard Tbutton does show some (olive) highlighting with the XP manifest on
> mouse-over, but still has no control over background colour so I use both.
> Happy to share it - especially if anyone improves on it further.
>
> John
>
>
>
> -----Original Message-----
> From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
> Behalf Of Robert martin
> Sent: Friday, 13 April 2007 4:29 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: [DUG] XP / Vista Themes
>
>
> Hi all
>
> Just playing with themes and notice that where we have edit combos 
> placed on Tab pages the colour is different.  We had set the colour of 
> some as clBtnFace so that their background colour was the same as the 
> form/ groupbox/ panel/ tab page they were on.  However with themes 
> enabled pagecontrols are using a different colour to clBtnFace.
>
> How do I set them to the same colour as the component they are on?  
> .ParentColor seems to get the forms colour / not the pageControls and 
> the page control does not have a colour property.
>
> Any suggestions ?
>
>
>   

-- 
*Rohit Gupta*
* B.E. Elec.   M.E.   Mem IEEE    Associate IEE*
*Technical Manager*
*Computer Fanatics Limited*
** 
*Tel*     +64 9 4892280
*Fax*    +64 9 4892290
*Email  *rohit at cfl.co.nz <mailto:rohit at cfl.co.nz>**
*Web    *www.cfl.co.nz <http://www.cfl.co.nz/>
 
------------------------------------------------------------------------
This email and any attachments contain information, which is 
confidential and may be subject to legal privilege and copyright. If you 
are not the intended recipient, you must not use, distribute or copy 
this email or attachments. If you have received this in error, please 
notify us immediately by return email and then delete this email and any 
attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20070416/d0eab2b9/attachment.html


More information about the Delphi mailing list