DataGridView.IsCurrentCellInEditMode DataGridView.IsCurrentCellInEditMode DataGridView.IsCurrentCellInEditMode DataGridView.IsCurrentCellInEditMode Property

정의

현재 활성 셀이 편집 중인지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the currently active cell is being edited.

public:
 property bool IsCurrentCellInEditMode { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool IsCurrentCellInEditMode { get; }
member this.IsCurrentCellInEditMode : bool
Public ReadOnly Property IsCurrentCellInEditMode As Boolean

속성 값

현재 셀이 편집 중이면true 이고, 그렇지 않으면 false입니다.true if the current cell is being edited; otherwise, false.

예제

다음 코드 예제에서는이 속성의 사용을 보여 줍니다.The following code example illustrates the use of this property. 이 예제는에서 사용할 수 있는 보다 큰 예제의 일부는 VirtualMode 참조 항목입니다.This example is part of a larger example available in the VirtualMode reference topic.

#pragma region Data store maintance

    void VirtualConnector::dataGridView1_CellValueNeeded
        (Object^ sender, DataGridViewCellValueEventArgs^ e)
    {
        if (store->ContainsKey(e->RowIndex))
        {
            // Use the store if the e value has been modified 
            // and stored.            
            e->Value = gcnew Int32(store->default[e->RowIndex]); 
        }
        else if (newRowNeeded && e->RowIndex == numberOfRows)
        {
            if (dataGridView1->IsCurrentCellInEditMode)
            {
                e->Value = initialValue;
            }
            else
            {
                // Show a blank e if the cursor is just loitering
                // over(the) last row.
                e->Value = String::Empty;
            }
        }
        else
        {
            e->Value = e->RowIndex;
        }
    }

    void VirtualConnector::dataGridView1_CellValuePushed
        (Object^ sender, DataGridViewCellValueEventArgs^ e)
    {
        String^ value = e->Value->ToString();
        store[e->RowIndex] = Int32::Parse(value, 
            CultureInfo::CurrentCulture);
    }
#pragma endregion
#region "data store maintance"
const int initialValue = -1;

private void dataGridView1_CellValueNeeded(object sender,
    DataGridViewCellValueEventArgs e)
{
    if (store.ContainsKey(e.RowIndex))
    {
        // Use the store if the e value has been modified 
        // and stored.            
        e.Value = store[e.RowIndex];
    }
    else if (newRowNeeded && e.RowIndex == numberOfRows)
    {
        if (dataGridView1.IsCurrentCellInEditMode)
        {
            e.Value = initialValue;
        }
        else
        {
            // Show a blank value if the cursor is just resting
            // on the last row.
            e.Value = String.Empty;
        }
    }
    else
    {
        e.Value = e.RowIndex;
    }
}

private void dataGridView1_CellValuePushed(object sender,
    DataGridViewCellValueEventArgs e)
{
    store.Add(e.RowIndex, int.Parse(e.Value.ToString()));
}
#endregion

private Dictionary<int, int> store = new Dictionary<int, int>();
#Region "data store maintance"
    Const initialValue As Integer = -1

    Private Sub dataGridView1_CellValueNeeded(ByVal sender As Object, _
        ByVal e As DataGridViewCellValueEventArgs) _
        Handles dataGridView1.CellValueNeeded

        If store.ContainsKey(e.RowIndex) Then
            ' Use the store if the e value has been modified 
            ' and stored.
            e.Value = store(e.RowIndex)
        ElseIf newRowNeeded AndAlso e.RowIndex = numberOfRows Then
            If dataGridView1.IsCurrentCellInEditMode Then
                e.Value = initialValue
            Else
                ' Show a blank value if the cursor is just resting
                ' on the last row.
                e.Value = String.Empty
            End If
        Else
            e.Value = e.RowIndex
        End If
    End Sub

    Private Sub dataGridView1_CellValuePushed(ByVal sender As Object, _
        ByVal e As DataGridViewCellValueEventArgs) _
        Handles dataGridView1.CellValuePushed

        store.Add(e.RowIndex, CInt(e.Value))

    End Sub
#End Region

    Dim store As System.Collections.Generic.Dictionary(Of Integer, Integer) = _
        New Dictionary(Of Integer, Integer)

설명

DataGridViewCheckBoxCell 포커스가 있는 편집 모드에는 항상 있습니다.A DataGridViewCheckBoxCell that has focus is always in edit mode. 현재 셀의 편집 컨트롤을 호스트 하는 경우 및 IsCurrentCellInEditMode 됩니다 true를 통해 편집 컨트롤을 검색할 수 있습니다를 EditingControl 속성입니다.If the current cell hosts an editing control and IsCurrentCellInEditMode is true, you can retrieve the editing control through the EditingControl property.

적용 대상

추가 정보