IDataGridViewEditingControl.ApplyCellStyleToEditingControl Metod

Definition

Ändrar kontrollens användargränssnitt så att det överensstämmer med det angivna cellformatet.

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)

Parametrar

dataGridViewCellStyle
DataGridViewCellStyle

Att DataGridViewCellStyle använda som modell för användargränssnittet.

Exempel

Följande kodexempel innehåller en implementering av den här medlemmen. Det här exemplet är en del av ett större exempel i How to: Host Controls in Windows Forms DataGridView Cells.

// 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

Kommentarer

Normalt anger en implementering av den här metoden gränssnittsegenskaper för redigeringskontrollen, till exempel teckensnitt, bakgrundsfärg och förgrundsfärg, till värdena för motsvarande egenskaper i dataGridViewCellStyle, vilket är det format som används för cellen som är värd för kontrollen.

Gäller för

Se även