Lire en anglais Modifier

Partager via


DataGridViewContentAlignment Enum

Definition

Defines constants that indicate the alignment of content within a DataGridView cell.

public enum DataGridViewContentAlignment
Inheritance
DataGridViewContentAlignment

Fields

Name Value Description
NotSet 0

The alignment is not set.

TopLeft 1

The content is aligned vertically at the top and horizontally at the left of a cell.

TopCenter 2

The content is aligned vertically at the top and horizontally at the center of a cell.

TopRight 4

The content is aligned vertically at the top and horizontally at the right of a cell.

MiddleLeft 16

The content is aligned vertically at the middle and horizontally at the left of a cell.

MiddleCenter 32

The content is aligned at the vertical and horizontal center of a cell.

MiddleRight 64

The content is aligned vertically at the middle and horizontally at the right of a cell.

BottomLeft 256

The content is aligned vertically at the bottom and horizontally at the left of a cell.

BottomCenter 512

The content is aligned vertically at the bottom and horizontally at the center of a cell.

BottomRight 1024

The content is aligned vertically at the bottom and horizontally at the right of a cell.

Examples

The following code example illustrates the use of this type. For more information, see How to: Format Data in the Windows Forms DataGridView Control.

this.dataGridView1.Columns["CustomerName"].DefaultCellStyle
    .Alignment = DataGridViewContentAlignment.MiddleRight;

Remarks

This enumeration is used by the DataGridViewCellStyle.Alignment property.

Applies to

Produit Versions
.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, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also