实现TableLayoutPanel控件的行列拆分的Sub过程
2007-07-27 12:19
495 查看
''' <summary>
''' 拆分TableLayoutPanel
''' </summary>
''' <param name="tlp"></param>
''' <param name="cellCount">拆分后的单元格数,只支持行列数相等的拆分</param>
''' <remarks>Author:朱二</remarks>
Private Sub DrawCell()Sub DrawCell(ByRef tlp As TableLayoutPanel, ByVal cellCount As Integer)
Dim columnCount, rowCount As Integer
columnCount = Math.Sqrt(cellCount)
rowCount = Math.Sqrt(cellCount)
'清空子控件,清空行列风格
tlp.Controls.Clear()
tlp1.ColumnStyles.Clear()
tlp1.RowStyles.Clear()
'设置行列数
tlp.ColumnCount = rowCount
tlp.RowCount = columnCount
'设置行高列宽
Dim i As Integer
For i = 1 To columnCount
tlp.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, tlp.Width / columnCount))
Next
For i = 1 To rowCount
tlp.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, tlp.Height / rowCount))
Next
End Sub
相关文章推荐
- 17_C# 实现VMS客户端——控件_TableLayoutPanel
- 解决TableLayoutPanel控件闪烁
- c# winForm TableLayoutPanel学习 合并行的布局及动态增加删除内部控件
- 如何改变TableLayoutPanel中之控件间的距离
- c# TableLayoutPanel控件应用 动态添加控件及事件
- 使用 TableLayoutPanel 控件设置窗体布局
- c#学习笔记之使用 TableLayoutPanel 控件设置窗体布局
- 演练:使用 TableLayoutPanel 在 Windows 窗体上排列控件
- C# TableLayoutPanel让一个控件占两行或者两列
- 在 TableLayoutPanel 控件中对齐和拉伸控件
- 关于TableLayoutPanel里放入控件无法将Dock设为Fill的解决办法
- 实现TableLayout布局下循环取出TableRow控件中的文字内容到list集合
- 使用 TableLayoutPanel 在 Windows 窗体上自动排列控件
- TableLayoutPanel控件动态删除一行,贴出来分享一下
- 使用 TableLayoutPanel 控件设置窗体布局
- C#学习日记2016-12-26 TableLayoutPanel控件以及页面布局
- c# TableLayoutPanel控件应用 动态添加控件及事件
- panel 与treeview控件的结合实现tablecontrol功能
- TableLayoutPanel容器中控件过多时显示出现闪烁的解决方案
- tableLayoutPanel容器,控件占多格的用法