wLayoutTable.cs
using System; using System.Drawing; using System.Windows.Forms; public class WLayoutTable : WCtrl { TableLayoutPanel table; public WLayoutTable(int row, int col) { ctrl = table = new TableLayoutPanel(); table.Name = ""; table.RowCount = row; table.ColumnCount = col; table.Location = new Point(10, 10); } public void setColumnSize( params int[] len ) { for( int i = 0; i < len.Length; i++ ) { ColumnStyle style = null; int length = i < len.Length ? len[i] : 0; if( length == 0 ) { style = new ColumnStyle(SizeType.AutoSize); //style.SizeType } else if( length > 0 ) { style = new ColumnStyle(SizeType.Percent, length); } else if( length < 0 ) { style = new ColumnStyle(SizeType.Absolute, -length); } table.ColumnStyles.Add(style); } } public void setRowSize( params int[] len ) { for( int i = 0; i < table.RowCount; i++ ) { RowStyle style = null; int length = i < len.Length ? len[i] : 0; if( length == 0 ) { style = new RowStyle(SizeType.AutoSize); //style.SizeType } else if( length > 0 ) { style = new RowStyle(SizeType.Percent, length); } else if( length < 0 ) { style = new RowStyle(SizeType.Absolute, -length); } table.RowStyles.Add(style); } } public void Add( Control ctrl, int row, int col ) { table.Controls.Add( ctrl, col, row ); } public void setColumnSpan( int row, int col, int num ) { Control ctl = table.GetControlFromPosition( col, row ); if( ctl != null ) { table.SetColumnSpan(ctl, num); } } public void setRowSpan( int row, int col, int num ) { Control ctl = table.GetControlFromPosition( col, row ); if( ctl != null ) { table.SetRowSpan(ctl, num); } } }
댓글 없음:
댓글 쓰기