private void AntgisToolBoxTree_MouseDown(object sender, MouseEventArgs e)
{
TreeListHitInfo treeListHitInfo = this.CalcHitInfo(new Point(e.X, e.Y));
TreeListNode node = treeListHitInfo.Node;
if (treeListHitInfo.HitInfoType == HitInfoType.Button)
return;
this.OptionsBehavior.Editable = false;
//鼠标右键
if (e.Button == MouseButtons.Right)
{
if (node == null)
{
this.FocusedNode = (TreeListNode) null;
this.CloseEditor();
this.Selection.Clear();
this.popupMenu3.ShowPopup(Control.MousePosition);
}
else
{
this.FocusedNode = node;
if (!node.HasChildren)
{
if (node.StateImageIndex <= 1)
this.popupMenu2.ShowPopup(Control.MousePosition);
else
this.popupMenu1.ShowPopup(Control.MousePosition);
}
else
this.popupMenu2.ShowPopup(Control.MousePosition);
}
}
//鼠标左键
else if (e.Button == MouseButtons.Left)
{
if (node == null)
{
this.CloseEditor();
this.Selection.Clear();
}
//e.Clicks = 2表示双击鼠标左键
else if (e.Clicks != 2)
node.Expanded = !node.Expanded;
}
}
网友评论