相关疑难解决方法(0)

获取Windows窗体中TableLayoutPanel单元格的高度和宽度

在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;
Run Code Online (Sandbox Code Playgroud)

上面,我的高度为0. RowStyle的SizeType为AutoSize.同样,我得到了33.33.ColumnStyle设置为SizeType为Percent,Size = 33.33.

我需要获得单元格的绝对大小(以像素为单位).

.net c# tablelayoutpanel cell winforms

16
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

cell ×1

tablelayoutpanel ×1

winforms ×1