DataGridColumnStyle.AlignmentChanged Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the Alignment property value changes.
public:
event EventHandler ^ AlignmentChanged;
public event EventHandler AlignmentChanged;
member this.AlignmentChanged : EventHandler
Public Custom Event AlignmentChanged As EventHandler
Event Type
Examples
The following code example demonstrates the use of this member.
private:
void AlignmentChanged_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
myMessage = "Alignment has been Changed";
}
void AddCustomDataTableStyle()
{
// Create a 'DataGridTableStyle'.
DataGridTableStyle^ myDataTableStyle = gcnew DataGridTableStyle;
myDataTableStyle->MappingName = "Customers";
// Create a 'DataGridColumnStyle'.
myDataGridColumnStyle = gcnew DataGridTextBoxColumn;
myDataGridColumnStyle->MappingName = "CustName";
myDataGridColumnStyle->HeaderText = "Customer Name";
myDataGridColumnStyle->Width = 250;
myDataGridColumnStyle->AlignmentChanged += gcnew EventHandler( this, &Form1::AlignmentChanged_Click );
// Add the 'DataGridColumnStyle' to 'DataGridTableStyle'.
myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle );
// Add the 'DataGridTableStyle' to 'DataGrid'.
myDataGrid->TableStyles->Add( myDataTableStyle );
}
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);
}
Private Sub AlignmentChanged_Click(ByVal sender As Object, ByVal e As EventArgs)
myMessage = "Alignment has been Changed"
End Sub
Private Sub AddCustomDataTableStyle()
' Create a 'DataGridTableStyle'.
Dim myDataTableStyle As New DataGridTableStyle()
myDataTableStyle.MappingName = "Customers"
' Create a 'DataGridColumnStyle'.
myDataGridColumnStyle = New DataGridTextBoxColumn()
myDataGridColumnStyle.MappingName = "CustName"
myDataGridColumnStyle.HeaderText = "Customer Name"
myDataGridColumnStyle.Width = 250
AddHandler myDataGridColumnStyle.AlignmentChanged, AddressOf AlignmentChanged_Click
' Add the 'DataGridColumnStyle' to 'DataGridTableStyle'.
myDataTableStyle.GridColumnStyles.Add(myDataGridColumnStyle)
' Add the 'DataGridTableStyle' to 'DataGrid'.
myDataGrid.TableStyles.Add(myDataTableStyle)
End Sub
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET