DataGridViewContentAlignment 列舉

定義

定義常數,其表示在 DataGridView 儲存格內的內容對齊方式。

public enum class DataGridViewContentAlignment
public enum DataGridViewContentAlignment
type DataGridViewContentAlignment = 
Public Enum DataGridViewContentAlignment
繼承
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 列舉。

適用於

另請參閱