DataGridViewContentAlignment 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義常數,其表示在 DataGridView 儲存格內的內容對齊方式。
public enum class DataGridViewContentAlignment
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 控制項中的資料。
this.dataGridView1.Columns["CustomerName"].DefaultCellStyle
.Alignment = DataGridViewContentAlignment.MiddleRight;
Me.dataGridView1.Columns("CustomerName").DefaultCellStyle _
.Alignment = DataGridViewContentAlignment.MiddleRight
備註
屬性會使用此 DataGridViewCellStyle.Alignment 列舉。