Example #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     PtButtonForm pf = new PtButtonForm();
     pf.PersonalTool = new CustomFigureTool(null, false, typeof(PolylineFigure), new DAuthorProperties(), null);
     if (pf.ShowDialog() == DialogResult.OK)
     {
         AddToListView(pf.PersonalTool);
         listView1.SelectedIndices.Clear();
         listView1.SelectedIndices.Add(listView1.Items.Count - 1);
     }
 }
Example #2
0
        void btnEdit_Click(object sender, EventArgs e)
        {
            UseDeactivate = false;
            tmrShown.Stop();

            PersonalToolbar.PtButtonForm f = new PersonalToolbar.PtButtonForm();
            f.PersonalTool = new PersonalToolbar.CustomFigureTool(null, false, figureClass, dap.Clone(), null);
            f.SetupToolEdit();
            if (f.ShowDialog() == DialogResult.OK)
            {
                dap.SetProperties(((PersonalToolbar.CustomFigureTool)f.PersonalTool).Dap);
                if (f.ToolEditAddToPersonal && AddToPersonalTools != null)
                    AddToPersonalTools(this, (PersonalToolbar.CustomFigureTool)f.PersonalTool);
            }

            Close();
        }
Example #3
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         PtButtonForm pf = new PtButtonForm();
         pf.PersonalTool = (PersonalTool)listView1.SelectedItems[0].Tag;
         if (pf.ShowDialog() == DialogResult.OK)
         {
             ListViewItem li = CreateListViewItem(pf.PersonalTool);
             SetImage(li);
             listView1.Items[listView1.SelectedIndices[0]] = li;
         }
     }
 }
Example #4
0
 void Item_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right && sender != btnCustomize)
     {
         if (ItemContext != null)
             ItemContext(sender, new EventArgs());
         ToolStripItem tsItem = (ToolStripItem)sender;
         if (tsItem.Owner != null)
         {
             // make context menu
             ContextMenuStrip menu = new ContextMenuStrip();
             ToolStripItem item = menu.Items.Add("Properties");
             item.Click += delegate(object s, EventArgs e2)
             {
                 PtButtonForm pf = new PtButtonForm();
                 pf.SetupToolButtonEdit();
                 if (tsItem is CustomFigureToolButton)
                     pf.PersonalTool = ((CustomFigureToolButton)tsItem).CustomFigure;
                 else if (tsItem is RunCmdToolButton)
                     pf.PersonalTool = ((RunCmdToolButton)tsItem).RunCmd;
                 else if (tsItem is ShowDirToolButton)
                     pf.PersonalTool = ((ShowDirToolButton)tsItem).ShowDir;
                 else if (tsItem is WebLinkToolButton)
                     pf.PersonalTool = ((WebLinkToolButton)tsItem).WebLink;
                 else if (tsItem is ModeSelectToolButton)
                     pf.PersonalTool = ((ModeSelectToolButton)tsItem).ModeSelect;
                 if (pf.ShowDialog() == DialogResult.OK)
                 {
                     ToolStripItem newTsItem = null;
                     if (pf.PersonalTool is CustomFigureTool)
                         newTsItem = new CustomFigureToolButton((CustomFigureTool)pf.PersonalTool);
                     else if (pf.PersonalTool is RunCmdTool)
                         newTsItem = new RunCmdToolButton((RunCmdTool)pf.PersonalTool);
                     else if (pf.PersonalTool is ShowDirTool)
                         newTsItem = new ShowDirToolButton((ShowDirTool)pf.PersonalTool);
                     else if (pf.PersonalTool is WebLinkTool)
                         newTsItem = new WebLinkToolButton((WebLinkTool)pf.PersonalTool);
                     else if (pf.PersonalTool is ModeSelectTool)
                         newTsItem = new ModeSelectToolButton((ModeSelectTool)pf.PersonalTool);
                     Items.Insert(Items.IndexOf(tsItem), newTsItem);
                     Items.Remove(tsItem);
                     // click it
                     if (newTsItem is CustomFigureToolButton)
                         newTsItem.PerformClick();
                 }
             };
             item = menu.Items.Add("Delete");
             item.Click += delegate(object s, EventArgs e2)
             {
                 Items.Remove(tsItem);
             };
             menu.Show(tsItem.Owner, tsItem.Bounds.Left + e.X, tsItem.Bounds.Top + e.Y);
         }
     }
 }