ColumnStyle 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示在表布局中列的外观。
public ref class ColumnStyle : System::Windows::Forms::TableLayoutStyle
	public class ColumnStyle : System.Windows.Forms.TableLayoutStyle
	type ColumnStyle = class
    inherit TableLayoutStyle
	Public Class ColumnStyle
Inherits TableLayoutStyle
		- 继承
 
示例
下面的代码示例演示了 ColumnStyle 如何从 . TableLayoutColumnStyleCollection.
此代码示例是为类提供的大型示例的 TableLayoutPanel 一部分。
private void toggleColumnStylesBtn_Click(
    System.Object sender, 
    System.EventArgs e)
{
    TableLayoutColumnStyleCollection styles = 
        this.TableLayoutPanel1.ColumnStyles;
    foreach( ColumnStyle style in styles )
    {
        if( style.SizeType == SizeType.Absolute )
        {
            style.SizeType = SizeType.AutoSize;
        }
        else if( style.SizeType == SizeType.AutoSize )
        {
            style.SizeType = SizeType.Percent;
            // Set the column width to be a percentage
            // of the TableLayoutPanel control's width.
            style.Width = 33;
        }
        else
        {
            // Set the column width to 50 pixels.
            style.SizeType = SizeType.Absolute;
            style.Width = 50;
        }
    }
}
Private Sub toggleColumnStylesBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles toggleColumnStylesBtn.Click
    Dim styles As TableLayoutColumnStyleCollection = _
    Me.TableLayoutPanel1.ColumnStyles
    For Each style As ColumnStyle In styles
        If style.SizeType = SizeType.Absolute Then
            style.SizeType = SizeType.AutoSize
        ElseIf style.SizeType = SizeType.AutoSize Then
            style.SizeType = SizeType.Percent
            ' Set the column width to be a percentage
            ' of the TableLayoutPanel control's width.
            style.Width = 33
        Else
            ' Set the column width to 50 pixels.
            style.SizeType = SizeType.Absolute
            style.Width = 50
        End If
    Next
End Sub
	注解
该 ColumnStyle 类表示用户界面 (UI) 列中的一个 TableLayoutPanel特征。 此类表中所有列的样式都收集在 TableLayoutPanel.ColumnStyles 属性中。
构造函数
| ColumnStyle() |  
		 将 ColumnStyle 类的新实例初始化为其默认状态。  | 
        	
| ColumnStyle(SizeType) |  
		 使用提供的 SizeType 值初始化 ColumnStyle 类的一个新实例。  | 
        	
| ColumnStyle(SizeType, Single) |  
		 使用提供的 SizeType 和宽度值初始化 ColumnStyle 类的实例。  | 
        	
属性
| SizeType | 
		   获取或设置一个标志,该标志指示应如何相对于其包含的表调整行或列的大小。 (继承自 TableLayoutStyle) | 
        	
| Width |  
		 获取或设置列的宽度值。  | 
        	
方法
| Equals(Object) | 
		   确定指定对象是否等于当前对象。 (继承自 Object) | 
        	
| GetHashCode() | 
		   作为默认哈希函数。 (继承自 Object) | 
        	
| GetType() | 
		   获取当前实例的 Type。 (继承自 Object) | 
        	
| MemberwiseClone() | 
		   创建当前 Object 的浅表副本。 (继承自 Object) | 
        	
| ToString() | 
		   返回表示当前对象的字符串。 (继承自 Object) |