This question already has answers here:
Can Delphi themed toolbars have dividers that are centred between their tool buttons?
(3 answers)
Closed 8 years ago.
I'm using Delphi XE6 on top of Windows 2012 R2, and trying to create applications with toolbars. I'm however experiencing problems with the compiled application having a vertical superfluous bar at the left hand side of any Separators I might add.
This problem is described in both This Question and This Other Question, however I am not trying to use any other fancy controls - I am solely using the "New Button" and "New Separator" to add items. I have nonetheless tried the suggested fixes to no avail.
My sample application has been created as follows:
New VCL Forms Application
Add TToolBar
Select ToolBar1
Right Click, Select "New Button"
Right Click, Select "New Button"
Right Click, Select "New Separator"
Right Click, Select "New Button"
Run
This is what the application looks like
I have tried changing every potentially applicable property of the TToolBar itself (including setting Transparent to False), as well as the ToolBar3 (which is set to tbsSeparator), but I cannot seem to get rid of this vertical bar. I have also tried to add a TXPManifest to the form, but this made no difference.
The only thing that does seem to make a difference is if I set the Separator Visible property to False - the line disappears, but so does the Separator, so this isn't any help.
The issue I'm experiencing is also described in This thread, and I can assure the readers that I've not made any changes to the width of the Separator - it's all default.
Does anybody have any suggestions on how I can fix this?
For what it's worth - my Delphi Form is like this - you can see that I'm not using any fancy controls other than the supported ones:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 112
ClientWidth = 382
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ToolBar1: TToolBar
Left = 0
Top = 0
Width = 382
Height = 29
Caption = 'ToolBar1'
TabOrder = 0
Transparent = False
object ToolButton1: TToolButton
Left = 0
Top = 0
Caption = 'ToolButton1'
ImageIndex = 0
end
object ToolButton2: TToolButton
Left = 23
Top = 0
Caption = 'ToolButton2'
ImageIndex = 1
end
object ToolButton3: TToolButton
Left = 46
Top = 0
Width = 8
Caption = 'ToolButton3'
ImageIndex = 2
Style = tbsSeparator
end
object ToolButton4: TToolButton
Left = 54
Top = 0
Caption = 'ToolButton4'
ImageIndex = 3
end
end
object XPManifest1: TXPManifest
Left = 40
Top = 48
end
end
As the TToolbar is a wrapper of Microsoft Windows Rebar32 Control, it looks exactly the same as a normal Windows application does. Why not remove these separators, so that you will not see them anymore.
Related
I would like to create a personalized style on expander in firemonkey.
But when I want to add an event on a button (I replace the checkbox by a button that I have drag and drop from palette), then when I save, the event disappear and is not triggered.
What am I doing wrong ?
Thanks in advance.
EDIT :
When I create/select an event from the dropdownmenu, when I saved the style, the selected event diseaper from the onclick event but my code is always written
EDIT 2 :
I have an Expander, and I would like to replace the default Checkbox by a Button.
So, I Edit the Default Style and replace the default Checkbox by a SpeedButton (like in the picture above)
At this Button, I want to add an Event on the OnClick. So I double click on the empty space beside the OnClick event and write the code into this event created automatically.
Once my code written, I'm go back in the Style Designer and I see the Event attached to the OnClick button, then I save the style.
But when I return to the Style Designer, the Event is not attached anymore to the Onclick event but he's still write/exist in code.
I tell myself I made a wrong saved, but the button him is still here, so I for me It's really saved.
I hope I'm clear.
LAST EDIT :
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 480
ClientWidth = 640
StyleBook = StyleBook1
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object Expander1: TExpander
Align = Client
ShowCheck = False
Size.Width = 640.000000000000000000
Size.Height = 480.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'Expander1Style1'
Text = 'Expander1'
TabOrder = 0
ContentSize = '455'
end
object StyleBook1: TStyleBook
Styles = <
item
end
item
Platform = 'Windows 10 Desktop'
ResourcesBin = {
464D585F5354594C4520322E3501060F457870616E646572315374796C653103
D9030623457870616E646572315374796C6531457870616E646572427574746F
6E5374796C6531037E0F061D457870616E646572315374796C6531436865636B
426F785374796C653103D00B005450463007544C61796F757400095374796C65
4E616D65060F457870616E646572315374796C653105416C69676E070643656E
7465720A53697A652E57696474680500000000000000A008400B53697A652E48
65696768740500000000000000F007401453697A652E506C6174666F726D4465
6661756C7408085461624F726465720251000A5452656374616E676C65000541
6C69676E0708436F6E74656E74730A46696C6C2E436F6C6F7207097846464630
463046300748697454657374080A53697A652E57696474680500000000000000
A008400B53697A652E4865696768740500000000000000F007401453697A652E
506C6174666F726D44656661756C74080C5374726F6B652E436F6C6F72070978
46464343434343430007544C61796F757400095374796C654E616D6506066865
6164657205416C69676E0703546F700A53697A652E5769647468050000000000
0000A008400B53697A652E4865696768740500000000000000C803401453697A
652E506C6174666F726D44656661756C74080005545465787400095374796C65
4E616D6506047465787405416C69676E0706436C69656E74064C6F636B656409
0748697454657374080C4D617267696E732E4C65667405000000000000008000
400D4D617267696E732E526967687405000000000000008000400A53697A652E
576964746805000000000000809208400B53697A652E48656967687405000000
00000000C803401453697A652E506C6174666F726D44656661756C7408045465
7874060454657874155465787453657474696E67732E576F7264577261700800
000F54457870616E646572427574746F6E00095374796C654E616D6506066275
74746F6E05416C69676E07084D6F73744C656674064C6F636B6564090A53697A
652E57696474680500000000000000C803400B53697A652E4865696768740500
000000000000C803401453697A652E506C6174666F726D44656661756C74080B
5374796C654C6F6F6B75700623457870616E646572315374796C653145787061
6E646572427574746F6E5374796C653100000C545370656564427574746F6E0C
62746E416464416374696F6E095374796C654E616D6506115370656564427574
746F6E315374796C6505416C69676E07094D6F737452696768740A506F736974
696F6E2E5805000000000000C09908400A53697A652E57696474680500000000
000000C803400B53697A652E4865696768740500000000000000C80340145369
7A652E506C6174666F726D44656661756C74080B5374796C654C6F6F6B757006
0D6164646974656D627574746F6E0454657874060C62746E416464416374696F
6E00000000005450463007544C61796F757400095374796C654E616D65062345
7870616E646572315374796C6531457870616E646572427574746F6E5374796C
65310A53697A652E57696474680500000000000000A008400B53697A652E4865
696768740500000000000000F007401453697A652E506C6174666F726D446566
61756C74080756697369626C6508085461624F72646572025200125442757474
6F6E5374796C654F626A65637400095374796C654E616D65060A6261636B6772
6F756E6405416C69676E070643656E746572074F706163697479050000000000
00000000000C536F757263654C6F6F6B7570061B57696E646F77732031302044
65736B746F707374796C652E706E670A53697A652E5769647468050000000000
0000D002400B53697A652E4865696768740500000000000000D002401453697A
652E506C6174666F726D44656661756C740808577261704D6F6465070643656E
74657207486F744C696E6B0E010F536F75726365526563742E4C656674050000
0000000000FA05400E536F75726365526563742E546F7005000000000000009E
074010536F75726365526563742E526967687405000000000000008A06401153
6F75726365526563742E426F74746F6D0500000000000080A407400001055363
616C650500000000000000C0FF3F0F536F75726365526563742E4C6566740500
000000000000BC06400E536F75726365526563742E546F700500000000000000
ED074010536F75726365526563742E52696768740500000000000000D0064011
536F75726365526563742E426F74746F6D0500000000000000F7074000010553
63616C6505000000000000008000400F536F75726365526563742E4C65667405
00000000000000FA06400E536F75726365526563742E546F7005000000000000
009E084010536F75726365526563742E526967687405000000000000008A0740
11536F75726365526563742E426F74746F6D0500000000000080A4084000000B
466F63757365644C696E6B0E010F536F75726365526563742E4C656674050000
0000000000DC05400E536F75726365526563742E546F7005000000000000009E
074010536F75726365526563742E52696768740500000000000000F605401153
6F75726365526563742E426F74746F6D0500000000000080A407400001055363
616C650500000000000000C0FF3F0F536F75726365526563742E4C6566740500
000000000000A506400E536F75726365526563742E546F700500000000000000
ED074010536F75726365526563742E52696768740500000000000000B9064011
536F75726365526563742E426F74746F6D0500000000000000F7074000010553
63616C6505000000000000008000400F536F75726365526563742E4C65667405
00000000000000DC06400E536F75726365526563742E546F7005000000000000
009E084010536F75726365526563742E52696768740500000000000000F60640
11536F75726365526563742E426F74746F6D0500000000000080A4084000000A
4E6F726D616C4C696E6B0E010F536F75726365526563742E4C65667405000000
00000000DC05400E536F75726365526563742E546F7005000000000000009E07
4010536F75726365526563742E52696768740500000000000000F6054011536F
75726365526563742E426F74746F6D0500000000000080A40740000105536361
6C650500000000000000C0FF3F0F536F75726365526563742E4C656674050000
0000000000A506400E536F75726365526563742E546F700500000000000000ED
074010536F75726365526563742E52696768740500000000000000B906401153
6F75726365526563742E426F74746F6D0500000000000000F707400001055363
616C6505000000000000008000400F536F75726365526563742E4C6566740500
000000000000DC06400E536F75726365526563742E546F700500000000000000
9E084010536F75726365526563742E52696768740500000000000000F6064011
536F75726365526563742E426F74746F6D0500000000000080A4084000000B50
7265737365644C696E6B0E010F536F75726365526563742E4C65667405000000
00000000FA05400E536F75726365526563742E546F7005000000000000009E07
4010536F75726365526563742E526967687405000000000000008A064011536F
75726365526563742E426F74746F6D0500000000000080A40740000105536361
6C650500000000000000C0FF3F0F536F75726365526563742E4C656674050000
0000000000BC06400E536F75726365526563742E546F700500000000000000ED
074010536F75726365526563742E52696768740500000000000000D006401153
6F75726365526563742E426F74746F6D0500000000000000F707400001055363
616C6505000000000000008000400F536F75726365526563742E4C6566740500
000000000000FA06400E536F75726365526563742E546F700500000000000000
9E084010536F75726365526563742E526967687405000000000000008A074011
536F75726365526563742E426F74746F6D0500000000000080A4084000001354
6F756368416E696D6174696F6E2E4C696E6B0E00000F54466C6F6174416E696D
6174696F6E00084475726174696F6E05000000000017B7D1F13F0C50726F7065
7274794E616D6506074F7061636974790A537461727456616C75650500000000
0000000000000953746F7056616C7565050000000000000080FF3F0754726967
67657206104973457870616E6465643D66616C73650E54726967676572496E76
65727365060F4973457870616E6465643D747275650000001254427574746F6E
5374796C654F626A65637400095374796C654E616D65060A6261636B67726F75
6E6405416C69676E070643656E7465720C536F757263654C6F6F6B7570061B57
696E646F7773203130204465736B746F707374796C652E706E670A53697A652E
57696474680500000000000000D002400B53697A652E48656967687405000000
00000000D002401453697A652E506C6174666F726D44656661756C7408085772
61704D6F6465070643656E74657207486F744C696E6B0E010F536F7572636552
6563742E4C6566740500000000000000FA05400E536F75726365526563742E54
6F70050000000000000095074010536F75726365526563742E52696768740500
0000000000008A064011536F75726365526563742E426F74746F6D0500000000
0000809B07400001055363616C650500000000000000C0FF3F0F536F75726365
526563742E4C6566740500000000000000BC06400E536F75726365526563742E
546F700500000000000080DF074010536F75726365526563742E526967687405
00000000000000D0064011536F75726365526563742E426F74746F6D05000000
00000080E907400001055363616C6505000000000000008000400F536F757263
65526563742E4C6566740500000000000000FA06400E536F7572636552656374
2E546F70050000000000000095084010536F75726365526563742E5269676874
05000000000000008A074011536F75726365526563742E426F74746F6D050000
00000000809B084000000B466F63757365644C696E6B0E010F536F7572636552
6563742E4C6566740500000000000000DC05400E536F75726365526563742E54
6F70050000000000000095074010536F75726365526563742E52696768740500
000000000000F6054011536F75726365526563742E426F74746F6D0500000000
0000809B07400001055363616C650500000000000000C0FF3F0F536F75726365
526563742E4C6566740500000000000000A506400E536F75726365526563742E
546F700500000000000080DF074010536F75726365526563742E526967687405
00000000000000B9064011536F75726365526563742E426F74746F6D05000000
00000080E907400001055363616C6505000000000000008000400F536F757263
65526563742E4C6566740500000000000000DC06400E536F7572636552656374
2E546F70050000000000000095084010536F75726365526563742E5269676874
0500000000000000F6064011536F75726365526563742E426F74746F6D050000
00000000809B084000000A4E6F726D616C4C696E6B0E010F536F757263655265
63742E4C6566740500000000000000DC05400E536F75726365526563742E546F
70050000000000000095074010536F75726365526563742E5269676874050000
0000000000F6054011536F75726365526563742E426F74746F6D050000000000
00809B07400001055363616C650500000000000000C0FF3F0F536F7572636552
6563742E4C6566740500000000000000A506400E536F75726365526563742E54
6F700500000000000080DF074010536F75726365526563742E52696768740500
000000000000B9064011536F75726365526563742E426F74746F6D0500000000
000080E907400001055363616C6505000000000000008000400F536F75726365
526563742E4C6566740500000000000000DC06400E536F75726365526563742E
546F70050000000000000095084010536F75726365526563742E526967687405
00000000000000F6064011536F75726365526563742E426F74746F6D05000000
000000809B084000000B507265737365644C696E6B0E010F536F757263655265
63742E4C6566740500000000000000FA05400E536F75726365526563742E546F
70050000000000000095074010536F75726365526563742E5269676874050000
00000000008A064011536F75726365526563742E426F74746F6D050000000000
00809B07400001055363616C650500000000000000C0FF3F0F536F7572636552
6563742E4C6566740500000000000000BC06400E536F75726365526563742E54
6F700500000000000080DF074010536F75726365526563742E52696768740500
000000000000D0064011536F75726365526563742E426F74746F6D0500000000
000080E907400001055363616C6505000000000000008000400F536F75726365
526563742E4C6566740500000000000000FA06400E536F75726365526563742E
546F70050000000000000095084010536F75726365526563742E526967687405
000000000000008A074011536F75726365526563742E426F74746F6D05000000
000000809B0840000013546F756368416E696D6174696F6E2E4C696E6B0E0000
0F54466C6F6174416E696D6174696F6E00084475726174696F6E050000000000
17B7D1F13F0C50726F70657274794E616D6506074F7061636974790A53746172
7456616C756505000000000000000000000953746F7056616C75650500000000
00000080FF3F0754726967676572060F4973457870616E6465643D747275650E
54726967676572496E766572736506104973457870616E6465643D66616C7365
000000005450463007544C61796F757400095374796C654E616D65061D457870
616E646572315374796C6531436865636B426F785374796C65310A53697A652E
57696474680500000000000000A008400B53697A652E48656967687405000000
00000000F007401453697A652E506C6174666F726D44656661756C7408075669
7369626C6508085461624F7264657202120007544C61796F75740005416C6967
6E07044C6566740A53697A652E576964746805000000000000009003400B5369
7A652E4865696768740500000000000000F007401453697A652E506C6174666F
726D44656661756C7408001154436865636B5374796C654F626A656374000953
74796C654E616D65060A6261636B67726F756E6405416C69676E070643656E74
6572074361704D6F6465070454696C65064C6F636B6564090C536F757263654C
6F6F6B7570061B57696E646F7773203130204465736B746F707374796C652E70
6E670A53697A652E57696474680500000000000000D002400B53697A652E4865
696768740500000000000000D002401453697A652E506C6174666F726D446566
61756C740808577261704D6F6465070643656E7465720D416374697665547269
676765720707436865636B65640A4163746976654C696E6B0E010F536F757263
65526563742E4C6566740500000000000000F803400E536F7572636552656374
2E546F70050000000000000092064010536F75726365526563742E5269676874
0500000000000000B0044011536F75726365526563742E426F74746F6D050000
00000000009F06400001055363616C650500000000000000C0FF3F0F536F7572
6365526563742E4C6566740500000000000000B804400E536F75726365526563
742E546F700500000000000000DB064010536F75726365526563742E52696768
74050000000000000082054011536F75726365526563742E426F74746F6D0500
000000000000EE06400001055363616C6505000000000000008000400F536F75
726365526563742E4C6566740500000000000000F804400E536F757263655265
63742E546F70050000000000000092074010536F75726365526563742E526967
68740500000000000000B0054011536F75726365526563742E426F74746F6D05
000000000000009F074000000A536F757263654C696E6B0E010F536F75726365
526563742E4C6566740500000000000000C000400E536F75726365526563742E
546F70050000000000000092064010536F75726365526563742E526967687405
0000000000000080034011536F75726365526563742E426F74746F6D05000000
000000009F06400001055363616C650500000000000000C0FF3F0F536F757263
65526563742E4C65667405000000000000008001400E536F7572636552656374
2E546F700500000000000000DB064010536F75726365526563742E5269676874
0500000000000000B8034011536F75726365526563742E426F74746F6D050000
0000000000EE06400001055363616C6505000000000000008000400F536F7572
6365526563742E4C6566740500000000000000C001400E536F75726365526563
742E546F70050000000000000092074010536F75726365526563742E52696768
74050000000000000080044011536F75726365526563742E426F74746F6D0500
0000000000009F0740000007486F744C696E6B0E010F536F7572636552656374
2E4C65667405000000000000008803400E536F75726365526563742E546F7005
0000000000000092064010536F75726365526563742E52696768740500000000
000000F0034011536F75726365526563742E426F74746F6D0500000000000000
9F06400001055363616C650500000000000000C0FF3F0F536F75726365526563
742E4C6566740500000000000000C803400E536F75726365526563742E546F70
0500000000000000DB064010536F75726365526563742E526967687405000000
00000000B0044011536F75726365526563742E426F74746F6D05000000000000
00EE06400001055363616C6505000000000000008000400F536F757263655265
63742E4C65667405000000000000008804400E536F75726365526563742E546F
70050000000000000092074010536F75726365526563742E5269676874050000
0000000000F0044011536F75726365526563742E426F74746F6D050000000000
00009F074000000D416374697665486F744C696E6B0E010F536F757263655265
63742E4C6566740500000000000000B404400E536F75726365526563742E546F
70050000000000000092064010536F75726365526563742E5269676874050000
0000000000E8044011536F75726365526563742E426F74746F6D050000000000
00009F06400001055363616C650500000000000000C0FF3F0F536F7572636552
6563742E4C65667405000000000000008605400E536F75726365526563742E54
6F700500000000000000DB064010536F75726365526563742E52696768740500
000000000000AC054011536F75726365526563742E426F74746F6D0500000000
000000EE06400001055363616C6505000000000000008000400F536F75726365
526563742E4C6566740500000000000000B405400E536F75726365526563742E
546F70050000000000000092074010536F75726365526563742E526967687405
00000000000000E8054011536F75726365526563742E426F74746F6D05000000
000000009F074000000B466F63757365644C696E6B0E010F536F757263655265
63742E4C65667405000000000000008803400E536F75726365526563742E546F
70050000000000000092064010536F75726365526563742E5269676874050000
0000000000F0034011536F75726365526563742E426F74746F6D050000000000
00009F06400001055363616C650500000000000000C0FF3F0F536F7572636552
6563742E4C6566740500000000000000C803400E536F75726365526563742E54
6F700500000000000000DB064010536F75726365526563742E52696768740500
000000000000B0044011536F75726365526563742E426F74746F6D0500000000
000000EE06400001055363616C6505000000000000008000400F536F75726365
526563742E4C65667405000000000000008804400E536F75726365526563742E
546F70050000000000000092074010536F75726365526563742E526967687405
00000000000000F0044011536F75726365526563742E426F74746F6D05000000
000000009F0740000011416374697665466F63757365644C696E6B0E010F536F
75726365526563742E4C6566740500000000000000B404400E536F7572636552
6563742E546F70050000000000000092064010536F75726365526563742E5269
6768740500000000000000E8044011536F75726365526563742E426F74746F6D
05000000000000009F06400001055363616C650500000000000000C0FF3F0F53
6F75726365526563742E4C65667405000000000000008605400E536F75726365
526563742E546F700500000000000000DB064010536F75726365526563742E52
696768740500000000000000AC054011536F75726365526563742E426F74746F
6D0500000000000000EE06400001055363616C6505000000000000008000400F
536F75726365526563742E4C6566740500000000000000B405400E536F757263
65526563742E546F70050000000000000092074010536F75726365526563742E
52696768740500000000000000E8054011536F75726365526563742E426F7474
6F6D05000000000000009F074000000000001654427574746F6E5374796C6554
6578744F626A65637400095374796C654E616D6506047465787405416C69676E
0706436C69656E74064C6F636B6564090C4D617267696E732E4C656674050000
0000000000C000400A53697A652E576964746805000000000000C09A08400B53
697A652E4865696768740500000000000000F007401453697A652E506C617466
6F726D44656661756C74080D536861646F7756697369626C650808486F74436F
6C6F720708636C61426C61636B0C466F6375736564436F6C6F720708636C6142
6C61636B0B4E6F726D616C436F6C6F720708636C61426C61636B0C5072657373
6564436F6C6F720708636C61426C61636B000000}
end>
end
end
I'm creating a VCL application and I want to style it exactly like Delphi itself is styled. For example, the tree view nodes when selected render really nicely (full width blue bar), see below
Yet mine looks like it's from Windows 98:
I'm hoping there's an easy way to get this to look nicer. Would love any ideas or pointers in the right direction. I've never done any custom/owner drawing before so this is new to me.
For a starter, you could just experiment a little with the available standard property settings. The following is the looks of the standard TTreeView on Windows 10, with just a few properties changed.
From the TextView of the form:
object TreeView1: TTreeView
Left = 8
Top = 8
Width = 225
Height = 283
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
HideSelection = False
HotTrack = True
Indent = 19
ParentFont = False
RowSelect = True
ShowLines = False
TabOrder = 0
end
Note the Hottrack = true, Rowselect = true and Showlines = False
The TStringGrid component I'm using in a C++ Builder project seems to alternate row colors by defaults. Even rows have a gray background while odd rows have a white background. How can I disable this alternate coloring so that all rows have the same background color?
Here's what it looks like:
And here is the corresponding entry in the DFM:
object StringGrid1: TStringGrid [0]
Left = 0
Top = 0
Width = 744
Height = 300
Align = alClient
FixedCols = 0
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Options = [goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goRowSelect]
ParentFont = False
TabOrder = 0
OnSelectCell = StringGrid1SelectCell
ColWidths = (
64
64
64
64
64)
end
I don't know which version of VCL you are using, but back in time, when I had been using great and very useful TStringGrid component, I did exactly the same thing, related to custom coloring cells, as you want to do. It is change related to behavior, not defined as property, I think.
You need to:
overload TStringGrid's virtual function for drawing cells in your particular derived class from TStringGrid
or,
on your TForm instance containing TStringGrid you want to modify, change behaviour of that particular TStringGrid.
So, basically you have choice, to make new class derived from TStringGrid and change behavior by overriding function for cell drawing, or to change existing, particular instance of TStringGrid by overriding just that grid's behavior with a help of great ObjectInspector, if it is still called like that.
It is better of course, to make new class and derive it from TStringGrid, and use it on Form(Parent container) directly which you can reuse later, whenever you want,
but it contains some additional work. Maybe, as start point, it is better to change behavior of particular TStringGrid instance you already dropped on ParetContainer(probably TForm) with using object inspector. If these directions are not enough for you, I can place here, some code samples that will be more helpful for you.
You should use event OnDrawCell. Here is working example:
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if( ( ARow % 2 ) == 0 )
{
if( ARow == 0 )
StringGrid1->Canvas->Brush->Color = clBlue;
else
StringGrid1->Canvas->Brush->Color = clGray;
StringGrid1->Canvas->FillRect( Rect );
}
}
Which properties I must set in a TToolbar control in order to show a beveled line between the rows of the buttons when a toolbar is set to autosize.
on this image the toolbar only show one row with buttons
If I resize the parent form the toolbar redistribute the buttons on more rows and a beveled line is added at the bottom of each row.
I tried with many properties in the TToolbar control, but not beveled line is added when the toolbar is resize.
These are the current toolbar settings
object ToolBar1: TToolBar
AlignWithMargins = True
Left = 3
Top = 3
Width = 137
Height = 74
AutoSize = True
BorderWidth = 1
Caption = 'ToolBar1'
EdgeBorders = [ebLeft, ebTop, ebRight, ebBottom]
Images = ImageList1
TabOrder = 0
And this is how looks.
You should group tool buttons with separators. They can be added by right click on the toolbar and select "New Separator". In the first snapshot, there are several separators, so that line break will be shown.
I was experimenting with list view groups, and it turns out the control displays incorrectly when the application starts.
As soon as I resize the form it displays correctly:
I do not understand what is happening. Can anyone explain?
It's a bug in the Delphi control which I have reproduced. I'm not sure yet what causes the bug. I have submitted this to Quality Central as QC#101104.
I found a simple workaround by adding the following code to the form's OnShow event.
ListView1.Align := alNone;
ListView1.Align := alClient;
The following DFM file is enough to demonstrate the problem:
object MyForm: TMyForm
Left = 0
Top = 0
ClientHeight = 300
ClientWidth = 635
object ListView1: TListView
Left = 200
Top = 96
Width = 250
Height = 150
Align = alClient
Columns = <
item
Caption = 'Column'
end>
Groups = <
item
Header = 'Group header'
GroupID = 0
end>
Items.ItemData = {
052A0000000100000000000000FFFFFFFFFFFFFFFF0000000000000000000000
000854006800650020006900740065006D00}
GroupView = True
ViewStyle = vsReport
end
end
It turns out that another way to resolve the problem is to move the ViewStyle entry in the DFM file so that it appears before the Items entry. So yet another workaround for the problem would be to add the items at runtime. In fact this probably explains why this bug has not been found since I bet that the overwhelming majority of list view code adds the items at runtime.