이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
번역
원본
이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

TreeNode.IsEditing 속성

트리 노드를 편집할 수 있는 상태에 있는지 여부를 나타내는 값을 가져옵니다.

네임스페이스:  System.Windows.Forms
어셈블리:  System.Windows.Forms(System.Windows.Forms.dll)
[BrowsableAttribute(false)]
public bool IsEditing { get; }

속성 값

형식: System.Boolean
true 트리 노드가 편집 가능한 상태에 있으면; 그렇지 않으면 false.

다음 코드 예제에서는 루트가 아닌 트리 노드를 사용 하 여 편집할 수 있는 ContextMenu. 오른쪽 마우스를 클릭할 때의 TreeNode 에 있는 위치 확인 하 고 명명 된 변수에 저장 mySelectedNode. 루트가 아닌 트리 노드를 선택 하면 사용자가 노드 레이블을 편집할 수 있도록 하는 편집 가능한 상태로 배치 됩니다. 사용자가 트리 노드 레이블의 편집을 중지 하면 새 레이블 텍스트가 평가 되 고 저장 됩니다. 이 예제에 대 한 여러 문자가 레이블 텍스트를 유효한 간주 되지 않습니다. 레이블 문자열에 잘못 된 문자 또는 문자열이 비어 있으면 사용자에 게 오류가 통지 되 고 레이블은 이전 텍스트로 반환 됩니다.


/* Get the tree node under the mouse pointer and 
   save it in the mySelectedNode variable. */
private void treeView1_MouseDown(object sender, 
  System.Windows.Forms.MouseEventArgs e)
{
   mySelectedNode = treeView1.GetNodeAt(e.X, e.Y);
}

private void menuItem1_Click(object sender, System.EventArgs e)
{
   if (mySelectedNode != null && mySelectedNode.Parent != null)
   {
      treeView1.SelectedNode = mySelectedNode;
      treeView1.LabelEdit = true;
      if(!mySelectedNode.IsEditing)
      {
         mySelectedNode.BeginEdit();
      }
   }
   else
   {
      MessageBox.Show("No tree node selected or selected node is a root node.\n" + 
         "Editing of root nodes is not allowed.", "Invalid selection");
   }
}

private void treeView1_AfterLabelEdit(object sender, 
         System.Windows.Forms.NodeLabelEditEventArgs e)
{
   if (e.Label != null)
   {
     if(e.Label.Length > 0)
     {
        if (e.Label.IndexOfAny(new char[]{'@', '.', ',', '!'}) == -1)
        {
           // Stop editing without canceling the label change.
           e.Node.EndEdit(false);
        }
        else
        {
           /* Cancel the label edit action, inform the user, and 
              place the node in edit mode again. */
           e.CancelEdit = true;
           MessageBox.Show("Invalid tree node label.\n" + 
              "The invalid characters are: '@','.', ',', '!'", 
              "Node Label Edit");
           e.Node.BeginEdit();
        }
     }
     else
     {
        /* Cancel the label edit action, inform the user, and 
           place the node in edit mode again. */
        e.CancelEdit = true;
        MessageBox.Show("Invalid tree node label.\nThe label cannot be blank", 
           "Node Label Edit");
        e.Node.BeginEdit();
     }
   }
}


.NET Framework

4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0에서 지원

.NET Framework Client Profile

4, 3.5 SP1에서 지원

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)

.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
이 정보가 도움이 되었습니까?
(1500자 남음)

커뮤니티 추가 항목

추가
© 2013 Microsoft. All rights reserved.