상속: System.Windows.Forms.ContextMenuStrip, IMetroControl
예제 #1
0
        private void tile_MouseUp(object sender, MouseEventArgs e)
        {
            MetroTileIcon tile = sender as MetroTileIcon;
            if (tile == null)
                return;
            MainForm mainForm = FindForm() as MainForm;
            if (mainForm == null || mainForm.ProjectModel == null)
                return;

            string assetPath = Path.Combine(mainForm.ProjectModel.WorkingDirectory, "assets");
            string path = tile.Tag as string;
            if (e.Button == MouseButtons.Left)
            {
                if (Directory.Exists(path))
                    SetViewPath(path);
                else if (File.Exists(path))
                    m_owner.ShowAssetProperties(Utils.GetRelativePath(path, assetPath + Path.DirectorySeparatorChar));//OpenFile(path);
            }
            else if (e.Button == MouseButtons.Right)
            {
                MetroContextMenu menu = new MetroContextMenu(null);
                MetroSkinManager.ApplyMetroStyle(menu);
                ToolStripMenuItem menuItem;

                menuItem = new ToolStripMenuItem("Rename");
                menuItem.Tag = path;
                menuItem.Click += menuItem_rename_Click;
                menu.Items.Add(menuItem);

                menuItem = new ToolStripMenuItem("Delete");
                menuItem.Tag = path;
                menuItem.Click += menuItem_delete_Click;
                menu.Items.Add(menuItem);

                menu.Show(tile, e.Location);
            }
        }
예제 #2
0
        private void m_menuAddTile_MouseUp(object sender, EventArgs e)
        {
            MetroTileIcon tile = sender as MetroTileIcon;
            if (tile == null)
                return;

            MetroContextMenu menu = new MetroContextMenu(null);
            MetroSkinManager.ApplyMetroStyle(menu);
            ToolStripMenuItem item;
            string name;
            string[] types = new string[] {
                "Import",
                "Animation",
                "Cubemap",
                "Css",
                "Json",
                "Html",
                "Material",
                "Script",
                "Text"
            };

            for (int i = 0; i < types.Length; ++i)
            {
                name = types[i];
                item = new ToolStripMenuItem(name);
                item.Tag = name;
                item.Click += addAsset_Click;
                menu.Items.Add(item);
            }

            menu.Show(tile, new Point(0, tile.Height));
        }