DataGrid.BackgroundColorChanged Kejadian
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Terjadi ketika BackgroundColor telah berubah.
public:
event EventHandler ^ BackgroundColorChanged;
public event EventHandler BackgroundColorChanged;
member this.BackgroundColorChanged : EventHandler
Public Custom Event BackgroundColorChanged As EventHandler
Jenis Acara
Contoh
Contoh kode berikut mengubah BackgroundColor nilai properti dari kuning menjadi merah dan menaikkan BackgroundColorChanged peristiwa.
// 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
Berlaku untuk
Berkolaborasi dengan kami di GitHub
Sumber untuk konten ini dapat ditemukan di GitHub, yang juga dapat Anda gunakan untuk membuat dan meninjau masalah dan menarik permintaan. Untuk informasi selengkapnya, lihat panduan kontributor kami.
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk