[Misfeature] GroupBox deosn't have XP style
Moderators: white, Hacker, petermad, Stefan2
[Misfeature] GroupBox deosn't have XP style
As I can see, TGroupBox control (frame around other controls) not uses XP style.
Look at native programs: GroupBox must have
- rounded corners
- grayed lines
- blue caption
Can it be fixed?
Look at native programs: GroupBox must have
- rounded corners
- grayed lines
- blue caption
Can it be fixed?
but if TC/CG says it supports XP styles, it also should support groupbox styles. IMHO! Turning off XP L&F should display the groupbox as it is displayed at the moment.szlori wrote:To be honest, I like this better than the XP look-and-feel groupbox...
Alextp
Support++, since it is a quite simple job to use XP L&F (just the same way as TC7 will (hopefully!) draw the XP L&F toolbar (buttons))
Regards,
CoolWater
If you include resources file WindowsXP.RES in your D5 program({$R WindowsXP.RES}) or directly use unit XPMan(in fact this unit includes the resource file above) you D5 program can also appear XP theme style. The RES file can be found in D7 install dir or you can make one by yourself, just a XP manifest file.
D7 version of "Dialogs.pas" implement a feature TOptionsEx, just one option "ofExNoPlacesBar", if it set true, no "Left vertical row of buttons". It's a feature of Windows 2000/XP, D5 can also do this if you initialize the dialog box yourself
D7 version of "Dialogs.pas" implement a feature TOptionsEx, just one option "ofExNoPlacesBar", if it set true, no "Left vertical row of buttons". It's a feature of Windows 2000/XP, D5 can also do this if you initialize the dialog box yourself
2Rocky
Manifest is already included, so most of controls have XP style - except TGroupBox.
Is there an option to set style for TGroupBox?
Manifest is already included, so most of controls have XP style - except TGroupBox.
I'll try it, thanks.D7 version of "Dialogs.pas" implement a feature TOptionsEx, just one option "ofExNoPlacesBar", if it set true, no "Left vertical row of buttons".
Is there an option to set style for TGroupBox?
Applied patch to TOpenDialog, it was easy.
Patch for TGroupBox is no so easy. THis needs to be added to TCustomGroupBox.Paint:
So, TThemeServices class from Themes.pas needs to be used (Themes.pas absent in D2-D5)...
Patch for TGroupBox is no so easy. THis needs to be added to TCustomGroupBox.Paint:
Code: Select all
if ThemeServices.ThemesEnabled then
begin
if Text <> '' then
begin
GetTextExtentPoint32(Handle, PChar(Text), Length(Text), Size);
CaptionRect := Rect(0, 0, Size.cx, Size.cy);
if not UseRightToLeftAlignment then
OffsetRect(CaptionRect, 8, 0)
else
OffsetRect(CaptionRect, Width - 8 - CaptionRect.Right, 0);
end
else
CaptionRect := Rect(0, 0, 0, 0);
OuterRect := ClientRect;
OuterRect.Top := (CaptionRect.Bottom - CaptionRect.Top) div 2;
with CaptionRect do
ExcludeClipRect(Handle, Left, Top, Right, Bottom);
if Enabled then
Box := tbGroupBoxNormal
else
Box := tbGroupBoxDisabled;
Details := ThemeServices.GetElementDetails(Box);
ThemeServices.DrawElement(Handle, Details, OuterRect);
SelectClipRgn(Handle, 0);
if Text <> '' then
ThemeServices.DrawText(Handle, Details, Text, CaptionRect, DT_LEFT, 0);
end
- ghisler(Author)
- Site Admin
- Posts: 48097
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks, I will try to add theming. However, the above code will not work correctly with all themes: The themes-specific DrawText uses theme-specific fonts for some themes. When using GetTextExtentPoint32, the font size of the currently selected font will be used instead.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 48097
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
OK, I had no problems to add theming to the TGroupBox (using the Theming API directly, not using a Delphi unit). The right function to call is GetThemeTextExtent instead of GetTextExtentPoint32. I tried it with several themes, and works OK.
However, there is another problem, see image:
http://ghisler.ch/img/groupbox.gif
The problem is that I'm using separator lines _within_ the groupbox to separate some items from each other. Of course this line doesn't use the groupbox border theme, so it looks odd. Any ideas how to solve this problem?
However, there is another problem, see image:
http://ghisler.ch/img/groupbox.gif
The problem is that I'm using separator lines _within_ the groupbox to separate some items from each other. Of course this line doesn't use the groupbox border theme, so it looks odd. Any ideas how to solve this problem?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 48097
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
That doesn't help, it's still a completely different part+style...I guess you have to draw using DrawThemeEdge.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
TBevel doesn't have XP style at all. So don't use it (inside GroupBox).
BTW, did you ever see such view (Bevel inside GroupBox) in *standard* Win or Office dialogs? I didn't.
TBevel doesn't have XP style at all. So don't use it (inside GroupBox).
BTW, did you ever see such view (Bevel inside GroupBox) in *standard* Win or Office dialogs? I didn't.
Last edited by Alextp on 2006-07-04, 10:39 UTC, edited 1 time in total.