DataGridViewContentAlignment 列舉

定義

定義常數,其表示在 DataGridView 儲存格內的內容對齊方式。Defines constants that indicate the alignment of content within a DataGridView cell.

public enum class DataGridViewContentAlignment
public enum DataGridViewContentAlignment
type DataGridViewContentAlignment = 
Public Enum DataGridViewContentAlignment
繼承
DataGridViewContentAlignment

欄位

BottomCenter 512

此內容會垂直對齊儲存格的下方並水平對齊儲存格的中央。The content is aligned vertically at the bottom and horizontally at the center of a cell.

BottomLeft 256

此內容會垂直對齊儲存格的下方並水平對齊儲存格的左方。The content is aligned vertically at the bottom and horizontally at the left of a cell.

BottomRight 1024

此內容會垂直對齊儲存格的下方並水平對齊儲存格的右方。The content is aligned vertically at the bottom and horizontally at the right of a cell.

MiddleCenter 32

此內容會垂直與水平對齊儲存格的中央。The content is aligned at the vertical and horizontal center of a cell.

MiddleLeft 16

此內容會垂直對齊儲存格的中間並水平對齊儲存格的左方。The content is aligned vertically at the middle and horizontally at the left of a cell.

MiddleRight 64

此內容會垂直對齊儲存格的中間並水平對齊儲存格的右方。The content is aligned vertically at the middle and horizontally at the right of a cell.

NotSet 0

未設定對齊。The alignment is not set.

TopCenter 2

此內容會垂直對齊儲存格的上方並水平對齊儲存格的中央。The content is aligned vertically at the top and horizontally at the center of a cell.

TopLeft 1

此內容會垂直對齊儲存格的上方並水平對齊儲存格的左方。The content is aligned vertically at the top and horizontally at the left of a cell.

TopRight 4

此內容會垂直對齊儲存格的上方並水平對齊儲存格的右方。The content is aligned vertically at the top and horizontally at the right of a cell.

範例

下列程式碼範例說明如何使用此類型。The following code example illustrates the use of this type. 如需詳細資訊,請參閱如何:格式化 Windows Forms DataGridView 控制項中的資料For more information, see How to: Format Data in the Windows Forms DataGridView Control.

this.dataGridView1.Columns["CustomerName"].DefaultCellStyle
    .Alignment = DataGridViewContentAlignment.MiddleRight;
Me.dataGridView1.Columns("CustomerName").DefaultCellStyle _
    .Alignment = DataGridViewContentAlignment.MiddleRight

備註

這個列舉是由DataGridViewCellStyle.Alignment屬性所使用。This enumeration is used by the DataGridViewCellStyle.Alignment property.

適用於

另請參閱