예제 #1
0
        private void EntityView_MouseUp(object sender, MouseEventArgs e)
        {
            var contextMenu = new ContextMenu();

            var c = EntityView.GetNodeAt(e.Location);

            if (e.Button == MouseButtons.Right && c != null)
            {
                Entity entity = (c as EntityTreeNode).Entity;
                contextMenu.MenuItems.Add(new MenuItem("Remove", (s, ea) =>
                {
                    if (entity.Parent == null)
                    {
                        activeScene.RemoveEntity(entity);
                    }
                    else
                    {
                        entity.Parent.RemoveEntity(entity);
                    };
                    c.Remove();
                }));
                contextMenu.MenuItems.Add(new MenuItem("Rename", (s, ea) => { }));
                contextMenu.Show(EntityView, e.Location);
            }
        }
예제 #2
0
 private void EntityView_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         EntityView.SelectedNode = EntityView.GetNodeAt(e.Location);
     }
 }