DataGrid.BackgroundColorChanged 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
BackgroundColor가 변경될 때 발생합니다.
public:
event EventHandler ^ BackgroundColorChanged;
public event EventHandler BackgroundColorChanged;
member this.BackgroundColorChanged : EventHandler
Public Custom Event BackgroundColorChanged As EventHandler
이벤트 유형
예제
다음 코드 예제에서는 속성 값을 노란색에서 빨간색으로 변경 BackgroundColor 하고 이벤트를 발생합니다 BackgroundColorChanged .
// Create an instance of the 'BackgroundColorChanged' EventHandler.
private:
void CallBackgroundColorChanged()
{
myDataGrid->BackgroundColorChanged += gcnew EventHandler( this, &MyDataGrid::Grid_ColChange );
}
// Set the 'BackgroundColor' property on click of button.
void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myDataGrid->BackgroundColor == Color::Yellow )
{
myDataGrid->BackgroundColor = Color::Red;
}
else
{
myDataGrid->BackgroundColor = Color::Yellow;
}
}
// Raise the event when 'Background' color of DataGrid changes.
void Grid_ColChange( Object^ /*sender*/, EventArgs^ /*e*/ )
{
// String variable used to show message.
String^ myString = "BackgroundColorChanged event raised, changed to ";
// Get the background color of DataGrid.
Color myColor = myDataGrid->BackgroundColor;
myString = String::Concat( myString, myColor );
// Show information about background color setting.
MessageBox::Show( myString, "Background color information" );
}
// Create an instance of the 'BackgroundColorChanged' EventHandler.
private void CallBackgroundColorChanged()
{
myDataGrid.BackgroundColorChanged += new EventHandler(Grid_ColChange);
}
// Set the 'BackgroundColor' property on click of button.
private void myButton_Click(object sender, EventArgs e)
{
if (myDataGrid.BackgroundColor == Color.Yellow)
{
myDataGrid.BackgroundColor = Color.Red;
}
else
{
myDataGrid.BackgroundColor = Color.Yellow;
}
}
// Raise the event when 'Background' color of DataGrid changes.
private void Grid_ColChange(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "BackgroundColorChanged event raised, changed to ";
// Get the background color of DataGrid.
Color myColor = myDataGrid.BackgroundColor;
myString += myColor.ToString();
// Show information about background color setting.
MessageBox.Show(myString, "Background color information");
}
' Create an instance of the 'BackgroundColorChanged' EventHandler.
Private Sub CallBackgroundColorChanged()
AddHandler myDataGrid.BackgroundColorChanged, AddressOf Grid_ColChange
End Sub
' Set the 'BackgroundColor' property on click of button.
Private Sub myButton_Click(ByVal sender As Object, ByVal e As EventArgs)
If op_Equality(myDataGrid.BackgroundColor, Color.Yellow) Then
myDataGrid.BackgroundColor = Color.Red
Else
myDataGrid.BackgroundColor = Color.Yellow
End If
End Sub
' Raise the event when 'Background' color of DataGrid changes.
Private Sub Grid_ColChange(ByVal sender As Object, ByVal e As EventArgs)
' String variable used to show message.
Dim myString As String = "BackgroundColorChanged event raised, changed to "
' Get the background color of DataGrid.
Dim myColor As Color = myDataGrid.BackgroundColor
myString += myColor.ToString()
' Show information about background color setting.
MessageBox.Show(myString, "Background color information")
End Sub
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET