DataGridColumnStyle.Alignment 属性

定义

获取或设置列中文本的对齐方式。

public:
 virtual property System::Windows::Forms::HorizontalAlignment Alignment { System::Windows::Forms::HorizontalAlignment get(); void set(System::Windows::Forms::HorizontalAlignment value); };
public virtual System.Windows.Forms.HorizontalAlignment Alignment { get; set; }
member this.Alignment : System.Windows.Forms.HorizontalAlignment with get, set
Public Overridable Property Alignment As HorizontalAlignment

属性值

HorizontalAlignment 值之一。 默认值为 Left。 有效选项包括 LeftCenterRight

示例

下面的代码示例将 中System.Windows.Forms.DataGridHorizontalAlignment.Center每列的 属性设置为 Alignment (如果数据不是字符串)。

Private Sub SetAlign()
   Dim myColumnStyle As DataGridColumnStyle 
   For each myColumnStyle In dataGrid1.TableStyles("Customers"). _
   GridColumnStyles
      myColumnStyle.Alignment = HorizontalAlignment.Center
   Next
End Sub

适用于