在Windows Forms中使用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设置为百分比,大小为33.33。
我需要获取单元格的绝对像素大小。