DataGridViewContentAlignment 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義常數,其表示在 DataGridView 儲存格內的內容對齊方式。
public enum class DataGridViewContentAlignment
C#
public enum DataGridViewContentAlignment
type DataGridViewContentAlignment =
Public Enum DataGridViewContentAlignment
- 繼承
BottomCenter | 512 | 此內容會垂直對齊儲存格的下方並水平對齊儲存格的中央。 |
BottomLeft | 256 | 此內容會垂直對齊儲存格的下方並水平對齊儲存格的左方。 |
BottomRight | 1024 | 此內容會垂直對齊儲存格的下方並水平對齊儲存格的右方。 |
MiddleCenter | 32 | 此內容會垂直與水平對齊儲存格的中央。 |
MiddleLeft | 16 | 此內容會垂直對齊儲存格的中間並水平對齊儲存格的左方。 |
MiddleRight | 64 | 此內容會垂直對齊儲存格的中間並水平對齊儲存格的右方。 |
NotSet | 0 | 未設定對齊。 |
TopCenter | 2 | 此內容會垂直對齊儲存格的上方並水平對齊儲存格的中央。 |
TopLeft | 1 | 此內容會垂直對齊儲存格的上方並水平對齊儲存格的左方。 |
TopRight | 4 | 此內容會垂直對齊儲存格的上方並水平對齊儲存格的右方。 |
下列程式碼範例說明如何使用此類型。 如需詳細資訊,請參閱如何:格式化 Windows Forms DataGridView 控制項中的資料。
C#
this.dataGridView1.Columns["CustomerName"].DefaultCellStyle
.Alignment = DataGridViewContentAlignment.MiddleRight;
Me.dataGridView1.Columns("CustomerName").DefaultCellStyle _
.Alignment = DataGridViewContentAlignment.MiddleRight
屬性會使用此 DataGridViewCellStyle.Alignment 列舉。
產品 | 版本 |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |