问题
My question is related to this one:
Can Delphi themed toolbars have dividers that are centred between their tool buttons?
I have a Delphi 7 application where I have a TToolButton
with Style = tbsSeparator
on a TToolBar
with Flat = True
. Using the fix accepted in the question mentioned above, a tbsSeparator
and a tbsDivider
are drawn as expected if the toolbar is themed (i.e. if my application has a theme manifest (XPMan
) and Windows themes is enabled on the system the application is running on).
However, if the application doesn't have a manifest or if the system doesn't have themes enabled, a tbsSeparator
is drawn with a vertical line in the middle, slightly smaller than that of a tbsDivider
:

On the screenshot, the one on the left is a tbsSeparator
(it shouldn't have the line in the middle), the one on the right is a tbsDivider
(that one's OK).
If I turn off the Flat
style everything is OK, but I want the Flat
style on a non-themed toolbar.
So, the question is how to have a tbsSeparator
drawn without a vertical line in the middle on a non-themed TToolBar
with Flat
style?
回答1:
Here is a quote from documentation:
The BTNS_SEP style creates a small gap between buttons or draws an etch between buttons on flat toolbars. ...
It states, an etch is drawn on separators of flat toolbars. There's no mention of dependency on themes..
来源:https://stackoverflow.com/questions/23113781/delphi-tbsseparator-ttoolbutton-on-a-non-themed-ttoolbar-with-flat-style-has-a-v