DataGridView.EditingControl Özellik

Tanım

Düzenleme denetimine sahip bir hücre düzenleme modundaysa geçerli hücre tarafından barındırılan denetimi alır.

public:
 property System::Windows::Forms::Control ^ EditingControl { System::Windows::Forms::Control ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Control EditingControl { get; }
[<System.ComponentModel.Browsable(false)>]
member this.EditingControl : System.Windows.Forms.Control
Public ReadOnly Property EditingControl As Control

Özellik Değeri

Control

Geçerli Control hücre tarafından barındırılan.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, bu özelliğin özel hücre türünün geçersiz kılınmış bir yönteminde nasıl kullanılacağını gösterir. Örnekte, düzenleme denetimine bir başvuru alınır, özel bir düzenleme denetimi türüne geçirilir ve hücrenin geçerli değeriyle doldurulur.

Bu örnek, How to: Host Controls in Windows Forms DataGridView Cells (Windows Forms DataGridView Hücrelerinde Denetimleri Barındırma) bölümünde bulunan daha büyük bir örneğin parçasıdır.

public override void InitializeEditingControl(int rowIndex, object 
    initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
{
    // Set the value of the editing control to the current cell value.
    base.InitializeEditingControl(rowIndex, initialFormattedValue, 
        dataGridViewCellStyle);
    CalendarEditingControl ctl = 
        DataGridView.EditingControl as CalendarEditingControl;
    // Use the default row value when Value property is null.
    if (this.Value == null)
    {
        ctl.Value = (DateTime)this.DefaultNewRowValue;
    }
    else
    {
        ctl.Value = (DateTime)this.Value;
    }
}
Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, _
    ByVal initialFormattedValue As Object, _
    ByVal dataGridViewCellStyle As DataGridViewCellStyle)

    ' Set the value of the editing control to the current cell value.
    MyBase.InitializeEditingControl(rowIndex, initialFormattedValue, _
        dataGridViewCellStyle)

    Dim ctl As CalendarEditingControl = _
        CType(DataGridView.EditingControl, CalendarEditingControl)

    ' Use the default row value when Value property is null.
    If (Me.Value Is Nothing) Then
        ctl.Value = CType(Me.DefaultNewRowValue, DateTime)
    Else
        ctl.Value = CType(Me.Value, DateTime)
    End If
End Sub

Açıklamalar

Hücre düzenleme modunda değilse veya hücre türü düzenleme denetimine uyum sağlamazsa, bu özellik döndürür null.

Şunlara uygulanır

Ayrıca bkz.