DataGridColumnStyle.AlignmentChanged Event

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'.
   myDataTableStyle.GridColumnStyles.Add(myDataGridColumnStyle);
   // Add the 'DataGridTableStyle' to 'DataGrid'.
   myDataGrid.TableStyles.Add(myDataTableStyle);
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft