Bagikan melalui


DataGridViewCellStyleContentChangedEventArgs.CellStyleScope Properti

Definisi

Mendapatkan cakupan yang dipengaruhi oleh gaya sel yang diubah.

public:
 property System::Windows::Forms::DataGridViewCellStyleScopes CellStyleScope { System::Windows::Forms::DataGridViewCellStyleScopes get(); };
public System.Windows.Forms.DataGridViewCellStyleScopes CellStyleScope { get; }
member this.CellStyleScope : System.Windows.Forms.DataGridViewCellStyleScopes
Public ReadOnly Property CellStyleScope As DataGridViewCellStyleScopes

Nilai Properti

DataGridViewCellStyleScopes yang menunjukkan entitas mana yang DataGridView memiliki gaya sel yang berubah.

Contoh

Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan kemunculan DataGridView.CellStyleContentChanged peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan. Untuk melaporkan beberapa peristiwa atau peristiwa yang sering terjadi, pertimbangkan untuk mengganti MessageBox.Show dengan Console.WriteLine atau menambahkan pesan ke multibaris TextBox.

Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis DataGridView bernama DataGridView1. Kemudian pastikan bahwa penanganan aktivitas dikaitkan dengan peristiwa.DataGridView.CellStyleContentChanged

private void DataGridView1_CellStyleContentChanged(Object sender, DataGridViewCellStyleContentChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellStyleContentChanged Event" );
}
Private Sub DataGridView1_CellStyleContentChanged(sender as Object, e as DataGridViewCellStyleContentChangedEventArgs) _ 
     Handles DataGridView1.CellStyleContentChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellStyleContentChanged Event")

End Sub

Keterangan

CellStyleScope Gunakan properti untuk menentukan properti mana yang berubahDataGridViewCellStyle. CellStyle Gunakan properti untuk mengambil nilai yang diperbarui.

Berlaku untuk

Lihat juga