Поделиться через


DataGridViewCellStyleContentChangedEventArgs.CellStyle Свойство

Определение

Возвращает измененный DataGridViewCellStyleобъект.

public:
 property System::Windows::Forms::DataGridViewCellStyle ^ CellStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); };
public System.Windows.Forms.DataGridViewCellStyle CellStyle { get; }
member this.CellStyle : System.Windows.Forms.DataGridViewCellStyle
Public ReadOnly Property CellStyle As DataGridViewCellStyle

Значение свойства

Изменено DataGridViewCellStyle.

Примеры

В следующем примере кода демонстрируется использование этого элемента. В этом примере обработчик событий сообщает о возникновении DataGridView.CellStyleContentChanged события. Этот отчет поможет вам узнать, когда происходит событие, и помочь вам в отладке. Чтобы сообщить о нескольких событиях или событиях, которые происходят часто, рекомендуется заменить MessageBox.ShowConsole.WriteLine или добавить сообщение в многостроочное TextBox.

Чтобы запустить пример кода, вставьте его в проект, содержащий экземпляр типа DataGridView с именем DataGridView1. Затем убедитесь, что обработчик событий связан с событием 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

Комментарии

Используйте это свойство для получения обновленного DataGridViewCellStyle значения свойства. CellStyleScope Используйте свойство, чтобы определить, какое свойство DataGridViewCellStyle изменилось.

Применяется к

См. также раздел