IDataGridViewEditingControl.ApplyCellStyleToEditingControl Methode

Definition

Ändert die Benutzeroberfläche des Steuerelements so, dass dieses dem angegebenen Zellenstil entspricht.

public:
 void ApplyCellStyleToEditingControl(System::Windows::Forms::DataGridViewCellStyle ^ dataGridViewCellStyle);
public void ApplyCellStyleToEditingControl (System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle);
abstract member ApplyCellStyleToEditingControl : System.Windows.Forms.DataGridViewCellStyle -> unit
Public Sub ApplyCellStyleToEditingControl (dataGridViewCellStyle As DataGridViewCellStyle)

Parameter

dataGridViewCellStyle
DataGridViewCellStyle

Der als Vorlage für die Benutzeroberfläche zu verwendende DataGridViewCellStyle.

Beispiele

Im folgenden Codebeispiel wird eine Implementierung dieses Members bereitgestellt. In diesem Beispiel handelt es sich um ein größeres Beispiel, das in How to: Host Controls in Windows Forms DataGridView Cells verfügbar ist.

// Implements the 
// IDataGridViewEditingControl.ApplyCellStyleToEditingControl method.
public void ApplyCellStyleToEditingControl(
    DataGridViewCellStyle dataGridViewCellStyle)
{
    this.Font = dataGridViewCellStyle.Font;
    this.CalendarForeColor = dataGridViewCellStyle.ForeColor;
    this.CalendarMonthBackground = dataGridViewCellStyle.BackColor;
}
Public Sub ApplyCellStyleToEditingControl(ByVal dataGridViewCellStyle As _
    DataGridViewCellStyle) _
    Implements IDataGridViewEditingControl.ApplyCellStyleToEditingControl

    Me.Font = dataGridViewCellStyle.Font
    Me.CalendarForeColor = dataGridViewCellStyle.ForeColor
    Me.CalendarMonthBackground = dataGridViewCellStyle.BackColor

End Sub

Hinweise

In der Regel legt eine Implementierung dieser Methode UI-Eigenschaften für das Bearbeitungssteuerelement fest, z. B. Schriftart, Hintergrundfarbe und Vordergrundfarbe, auf die Werte der entsprechenden Eigenschaften in der dataGridViewCellStyleZelle, die für die Zelle verwendet wird, die das Steuerelement hostet.

Gilt für:

Siehe auch