Delphi – Change Ttoolbar Background Color

I encountered a problem, I usually cannot use its property ToolBar.Color to change the background color of TToolBar (such as clwhite). I am not very experienced in Delphi, I found two Possible solution, but I still want to know, how to change it correctly or why it is not possible.

1) Change the style to gradient, but it will also change the basic animation of the button.

ToolBar.DrawingStyle := dsGradient
ToolBar.GradientStartColor := clWhite
ToolBar.GradientEndColor := clWhite

2)Use The following settings put TToolBar in TPanel.

Panel.Color := clwhite
ToolBar.Parent := Panel
ToolBar.Align := alClient< br />ToolBar.Transparent := True

By default, TToolbar ignores its Color property.
By default, the Transparent property is true, so no matter what the parent color of the toolbar is, it will shine.

If you look at the VCL source code, you will see that TToolbar does not have its own The drawing; it is a wrapper for the ToolbarWindow32 Win32 common control in ComCtl32.dll.
This is the code for drawing.
When Windows XP was introduced, Microsoft added UI themes, and Borland passed VCL.Themes .TStyleManager supports this.
You can change the appearance of common controls through the style manager: Project -> Options -> Appearance -> Custom Style, but it is difficult to know what effect it has because of the IDE The result is not displayed (you can see it at runtime), you can only choose from a limited list of strange themes; this feature is also wrong.

The same is true for TPageControl / TTabSheet, it will not publish its Color propery .
All controls imported through ComCtl32.dll and implemented by VCL.ComCtrls will be affected by these inconsistencies.

In short
There is nothing to make TToolbar respect its Color property.
You have found a solution:

>Use the same GradientEndColor and GradientStartColor to set the gradient.>Place the toolbar on another control (such as TPanel) and change the color of that control, because the tool The column is transparent and the parent color will pass through. You need to set the BevelInner/BevelOuter of the panel to bvNone.>Enable the VCL style and encounter all the problems related to the company’s checkbox anti-pattern.

I encountered a problem, I usually can’t use its property ToolBar.Color to change the background color of TToolBar (e.g. clwhite). I am not very experienced in Delphi, I found two possible solutions Scheme, but I still want to know, how to change it correctly or why it is impossible.

1) Change the style to gradient, but it will also change the basic animation of the button.

ToolBar.DrawingStyle := dsGradient
ToolBar.GradientStartColor := clWhite
ToolBar.GradientEndColor := clWhite

2) Use the following settings to Put TToolBar into TPanel.

Panel.Color := clwhite
ToolBar.Parent := Panel
ToolBar.Align := alClient
ToolBar.Transparent := True

By default, TToolbar ignores its Color property.
By default, the Transparent property is true, so regardless of the tool Whatever the parent color of the bar is, it will shine.

If you look at the VCL source code, you will see that TToolbar does not have its own drawing; it is a package of ToolbarWindow32 Win32 common control in ComCtl32.dll
This is the code for drawing.
When Windows XP was introduced, Microsoft added UI themes, B orland supports this through VCL.Themes.TStyleManager.
You can change the appearance of common controls through the style manager: Project -> Options -> Appearance -> Custom style, but it is difficult Know what effect it has, because the IDE does not display the results (you can see it at runtime), you can only choose from a limited list of strange themes; this feature is also wrong.

TPageControl / TTabSheet The same is true, it will not release its Color propery.
All controls imported through ComCtl32.dll and implemented by VCL.ComCtrls will be affected by these inconsistencies.

In short
No What can make TToolbar respect its Color property.
You have found a solution:

>Use the same GradientEndColor and GradientStartColor to set the gradient.>Place the toolbar in another control (such as TPanel) Click and change the color of the control, because the toolbar is transparent, the parent color will pass through. You need to set the BevelInner/BevelOuter of the panel to bvNone.> Enable the VCL style and encounter the company’s checkbox anti-pattern related All questions.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3145 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.