2014-03-02 64 views

回答

1

假設的WinForms,嘗試在BeforeLabelEdit事件取消編輯:

public Form1() { 
    InitializeComponent(); 
    treeView1.BeforeLabelEdit += treeView1_BeforeLabelEdit; 
} 

void treeView1_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) { 
    if (e.Node.Level == 0) { 
    e.CancelEdit = true; 
    } 
}