【发布时间】:2012-11-23 10:13:05
【问题描述】:
在 Windows 窗体中使用 TableLayoutPanel。我使用 RowStyles 和 ColumnStyles SizeType 分别作为 AutoSize 和 Percent。我需要找出放置特定控件的单元格的绝对高度和宽度。
TableLayoutPanelCellPosition pos = tableLayoutPanel1.GetCellPosition(button1);
int height = (int)tableLayoutPanel1.RowStyles[pos.Row].Height;
int width = (int)tableLayoutPanel1.ColumnStyles[pos.Column].Width;
在上面,我将高度设为 0。RowStyle 与 SizeType 作为 AutoSize。 同样,我得到 33.33。 ColumnStyle 设置为 SizeType 为 Percent,Size = 33.33。
我需要获取单元格的绝对大小(以像素为单位)。
【问题讨论】:
标签: c# .net winforms cell tablelayoutpanel