简体   繁体   English

为什么TToolBar不想包装?

[英]Why TToolBar doesn't want to wrap?

I put a TToolBar on my form and add some TSpeedButton . 我在TToolBar上放了一个TToolBar ,并添加了一些TSpeedButton I ensure myself that Wrapable is set to true and run the application. 我确保将Wrapable设置为true并运行该应用程序。 But when I shrink the form the buttons don't wrap on new line. 但是当我缩小表单时,按钮不会换行。 What am I missing ? 我想念什么? I am using Delphi 2009. 我正在使用Delphi 2009。

You need to set the TToolBar.AutoSize to True , and add separators between groups of buttons so there's a place for it to split the toolbar into sections. 您需要将TToolBar.AutoSize设置为True ,并在按钮组之间添加分隔符,以便可以将工具栏拆分为多个部分。

It's also better to use TToolButton on the TToolBar instead, as it's designed to work with them. 最好也改用TToolButton上的TToolBar ,因为它是为与它们一起使用而设计的。 Right-click the toolbar and choose New Button or New Separator . 右键单击工具栏,然后选择New ButtonNew Separator Assign the images you want to display to a TImageList , and assign the imagelist to the TToolbar.Images property, then set the ImageIndex for each button to display an image from the list. 将要显示的图像分配给TImageList ,并将图像列表分配给TToolbar.Images属性,然后为每个按钮设置ImageIndex以显示列表中的图像。 (Another advantage is that you can also separate imagelists to the HotImages and DisabledImages properties as well.) (另一个优点是,您还可以将图像列表也分离到HotImagesDisabledImages属性。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM