DataGridViewContentAlignment 枚举    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义常数,该常数指示 DataGridView 单元格中内容的对齐方式。
public enum class DataGridViewContentAlignmentpublic enum DataGridViewContentAlignmenttype 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 窗体 DataGridView 控件中的数据格式。
this.dataGridView1.Columns["CustomerName"].DefaultCellStyle
    .Alignment = DataGridViewContentAlignment.MiddleRight;
Me.dataGridView1.Columns("CustomerName").DefaultCellStyle _
    .Alignment = DataGridViewContentAlignment.MiddleRight
注解
该属性使用此 DataGridViewCellStyle.Alignment 枚举。