[DUG] XP / Vista Themes

John Bird johnkbird at paradise.net.nz
Fri Apr 13 21:33:16 NZST 2007


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 ?


-- 
Rob Martin
Software Engineer

phone +64 03 377 0495
fax   +64 03 377 0496
web www.chreos.com

Wild Software Ltd

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe

__________ NOD32 2185 (20070412) Information __________

This message was checked by NOD32 antivirus system. http://www.eset.com





More information about the Delphi mailing list