IDataGridViewEditingControl.ApplyCellStyleToEditingControl Methode

Definition

Ändert die Benutzeroberfläche des Steuerelements so, dass sie mit der angegebenen Zellenformatvorlage konsistent ist.

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 DataGridViewCellStyle als Modell für die Benutzeroberfläche zu verwendende Benutzeroberflächen.

Beispiele

Das folgende Codebeispiel stellt eine Implementierung dieses Elements bereit. Dieses Beispiel ist Teil eines größeren Beispiels, 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:

Weitere Informationen