DataGridColumnStyle.AlignmentChanged Event


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Occurs when the Alignment property value changes.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event EventHandler AlignmentChanged

The following code example demonstrates the use of this member.

private void AlignmentChanged_Click(object sender, EventArgs e)
     myMessage = "Alignment has been Changed"; 
private void AddCustomDataTableStyle()
   // Create a 'DataGridTableStyle'.
   DataGridTableStyle myDataTableStyle = new DataGridTableStyle();
   myDataTableStyle.MappingName = "Customers";
   // Create a 'DataGridColumnStyle'.
   myDataGridColumnStyle = new DataGridTextBoxColumn();
   myDataGridColumnStyle.MappingName = "CustName";
   myDataGridColumnStyle.HeaderText = "Customer Name";
   myDataGridColumnStyle.Width = 250;
   myDataGridColumnStyle.AlignmentChanged+=new EventHandler(AlignmentChanged_Click);
   // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'.
   // Add the 'DataGridTableStyle' to 'DataGrid'.

.NET Framework
Available since 1.1
Return to top