Delphi如何使用TGridPanel [英] Delphi How to use TGridPanel

查看:1100
本文介绍了Delphi如何使用TGridPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Delphi的2009 TGridPanel,但我不知道如何正确使用它.

I want to use Delphi's 2009 TGridPanel, but I don't understand how to use it correctly.

例如,我希望有一个包含4列的GridPanel,该列应分别占GripPanels宽度的25%.

For example, I want to have a GridPanel with 4 columns which should have each 25% percent of the GripPanels width.

因此,我在窗体上放置了一个GripPanel并添加了4个ColumnItems. 我为列项目提供SizeStyle ssPercent,现在尝试为每个ColummItem赋予25的值(对象检查器之后). 但是由于某些原因,对象检查器不接受值25.它会自动更改为"23,8095238095238"之类的值. 简而言之,有人可以向我解释如何使用此组件吗? 谢谢!

So I put a GripPanel on the form and add 4 ColumnItems. I give the column items SizeStyle ssPercent, and now I try to give each ColummItem a Value of 25 (ober the object inspector). But for some reasons the object inspector doesn't accept the value 25. It's automatically changed to something like '23,8095238095238'. Could somebody explain me in short how to use this components? Thanks!

推荐答案

使用SizeStyle ssPercent设置列的Value时,组件将分配所有ssPercent样式的列的新总和,以提供总计百分比.例如,如果您有4个25%的列,并且现在将一列设置为50%,则总共有125%.该组件再次计算值",以使总值按比例分配,即50%-> 40%(100 * 50/125).

When you set the Value of a column with SizeStyle ssPercent, the component distributes the new sum of all ssPercent styled columns for the available total percentage. For instance, if you've got 4 25% columns and you set one to be 50% now you've got a total of 125%. The component calculates 'Value's again to have the total distributed proportionally, i.e. 50% -> 40% (100*50/125) .

要一次设置多个列的值,请在运行时用GridPanel.ColumnCollection.BeginUpdateGridPanel.ColumnCollection.EndUpdate包围代码.

To set the value of more than one columns at once, at run time you'd surround your code with GridPanel.ColumnCollection.BeginUpdate and GridPanel.ColumnCollection.EndUpdate.

然后在设计时直接编辑.dfm.在设计编辑器中查看表单时,按"Alt + F12",在文本编辑器中找到GridPanel,在其中编辑列的值,然后再次按"Alt + F12"返回设计视图.

And at design time edit the .dfm directly. Press 'Alt+F12' when you're viewing your form in the design editor, find your GridPanel in the text editor, edit the value of the columns there, and then press 'Alt+F12' again to return to the design view.

这篇关于Delphi如何使用TGridPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆