下面的示例通过接管 TreeList.BeforeFocusNode 事件,禁止把焦点移入控件中的第一个节点。

C#CopyCode image复制代码
private void treeList1_BeforeFocusNode(object sender, 
DevExpress.XtraTreeList.BeforeFocusNodeEventArgs e) {
   if (e.Node.Id == treeList1.Nodes[0].Id) 
      e.CanFocus = false;
}
Visual BasicCopyCode image复制代码
Private Sub TreeList1_BeforeFocusNode(ByVal sender As Object, 
ByVal e As DevExpress.XtraTreeList.BeforeFocusNodeEventArgs) 
Handles TreeList1.BeforeFocusNode
   If e.Node.Id = TreeList1.Nodes(0).Id Then
      e.CanFocus = False
   End If
End Sub