private void LayerTreeList_MouseUp(object sender, MouseEventArgs e)
{
TreeList myTreeList = sender as TreeList;
TreeListHitInfo myHitInfo = myTreeList.CalcHitInfo(new Point(e.X, e.Y));
TreeListNode myHitNode = myHitInfo.Node;
if (e.Button == MouseButtons.Right && myHitNode != null)//右键
{
myTreeList.SetFocusedNode(myHitNode);
if (!myTreeList.FocusedNode.HasChildren && (myTreeList.FocusedNode.Tag as ObjectLayer).DataType == GlobeDataLayerType.Model)//是数据节点
{
if (((myTreeList.FocusedNode.Tag as ObjectLayer).Data as ModelLayer).NightFactor != -1.0f)
{
this.OpenNightFactor.Enabled = true;
}
else
{
this.OpenNightFactor.Enabled = false;
}
//TreelistBar.SetPopupContextMenu(myTreeList, TreelistPopuupMenu);//这样会在任意地方弹出来
TreelistPopuupMenu.ShowPopup(MousePosition);
}
else
{
myTreeList.ContextMenuStrip = null;
}
}
}