예제 #1
0
        public void DropToolBoxItem(ToolBoxItem item, Point where)
        {
            Tile tile = this.AddTile(item.Object as Sprite, this.panelGrid.PointToClient(where));

            this.SetTileSelected(tile, true);
            this.PushForUndoRedo();
        }
예제 #2
0
 private void ToolBox1_ItemMouseDown(ToolBoxItem sender, MouseEventArgs e)
 {
     labelItems.Add(Activator.CreateInstance(sender.Object as Type) as LabelItem);
     labelItems[labelItems.Count - 1].Name += labelItems.Count.ToString();
     comboBox1.SelectedIndex      = comboBox1.Items.Count - 1;
     propertyGrid2.SelectedObject = labelItems[labelItems.Count - 1];
     pagePreview1.Refresh();
 }
예제 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            DateTimePicker date = new DateTimePicker();

            date.Show();
            ToolBoxItem item = new ToolBoxItem();

            toolBoxGroup1.Add(item);
        }
예제 #4
0
 private void u8toolBox_ItemMouseDown(ToolBoxItem sender, MouseEventArgs e)
 {
     if (sender.Caption == "数据导入")
     {
         //显示tab control 及对应标签页
         U8tabCtl.Visible           = true;
         U8dataimporttabPage.Parent = U8tabCtl;
     }
 }
예제 #5
0
        public DummyToolbox()
        {
            InitializeComponent();

            #region Ìí¼ÓToolBox

            string fileName = Application.StartupPath + @"\..\..\data\ControlLibrary.xml";
            ComponentLibraryLoader componentLibraryLoader = new ComponentLibraryLoader();
            componentLibraryLoader.LoadToolComponentLibrary(fileName);

            toolBox = new ToolBox.ToolBox {
                Dock = DockStyle.Fill
            };

            foreach (Category category in componentLibraryLoader.Categories)
            {
                if (category.IsEnabled)
                {
                    ToolBoxCategory cate = new ToolBoxCategory();
                    cate.ImageIndex = -1;
                    cate.IsOpen     = false;
                    cate.Name       = category.Name;
                    cate.Parent     = null;

                    ToolBoxItem item = new ToolBoxItem();
                    item.Tag    = null;
                    item.Name   = "<Pointer>";
                    item.Parent = null;
                    cate.Items.Add(item);

                    foreach (ToolComponent component in category.ToolComponents)
                    {
                        item = new ToolBoxItem();

                        System.Drawing.Design.ToolboxItem toolboxItem = new System.Drawing.Design.ToolboxItem();
                        toolboxItem.TypeName    = component.FullName;
                        toolboxItem.Bitmap      = componentLibraryLoader.GetIcon(component);
                        toolboxItem.DisplayName = component.Name;
                        Assembly asm = component.LoadAssembly();
                        toolboxItem.AssemblyName = asm.GetName();

                        item.Image  = toolboxItem.Bitmap;
                        item.Tag    = toolboxItem;
                        item.Name   = component.Name;
                        item.Parent = null;

                        cate.Items.Add(item);
                    }

                    toolBox.Categories.Add(cate);
                }
            }

            pnlToolBox.Controls.Add(toolBox);//×ó±ßpanelÌí¼Ó¿Ø¼þ

            #endregion
        }
예제 #6
0
        public ToolBoxItemControl(ToolBoxItem toolBoxItem, ToolBoxItemDelegate toolBoxItemDelegate)
        {
            InitializeComponent();

            this.toolBoxItem         = toolBoxItem;
            this.toolBoxItemDelegate = toolBoxItemDelegate;

            ToolBoxText.Text = toolBoxItem.ToString();
        }
예제 #7
0
 public void SelectToolBoxItem(ToolBoxItem toolBoxItem)
 {
     foreach (ToolBoxItemControl item in this.toolBoxItems)
     {
         if (item.GetToolBoxItem() == toolBoxItem)
         {
             item.SelectToolBoxButton();
             break;
         }
     }
 }
예제 #8
0
        public void AddToolBoxItem(ToolBoxItem toolBoxItem, ToolBoxItemDelegate toolBoxItemDelegate)
        {
            ToolBoxItemControl toolBoxItemControl = new ToolBoxItemControl(toolBoxItem, toolBoxItemDelegate);

            if (this.toolBoxItems.Count > 0)
            {
                this.UpdateMargin(toolBoxItemControl);
            }

            ToolBoxContainer.Children.Add(toolBoxItemControl);

            this.toolBoxItems.Add(toolBoxItemControl);
        }
예제 #9
0
        public void AddTool(ICommand cmd)
        {
            var command = cmd as SchemaEditor.SchemaCommands.ToolCommand;

            if (command == null)
            {
                return;
            }

            _toolBox.ItemSelectionChanged -= new ItemSelectionChangedHandler(ToolChanged);
            _toolBox.TabSelectionChanged  -= new TabSelectionChangedHandler(ToolChanged);



            var        imgnum = 0;
            ToolBoxTab tbt;

            if ((tbt = _toolBox[command.ToolGroup]) == null)
            {
                tbt = new ToolBoxTab(command.ToolGroup, -1);
                _toolBox.AddTab(tbt);
            }

            _toolBox.SmallImageList.Images.Add(command.ToolIcon);
            var tbi = new ToolBoxItem(command.ToolName, _toolBox.SmallImageList.Images.Count - 1);

            tbt.AddItem(tbi);
            tbi.Object = command;

            _toolBox.ItemSelectionChanged += new ItemSelectionChangedHandler(ToolChanged);
            _toolBox.TabSelectionChanged  += new TabSelectionChangedHandler(ToolChanged);

            /*for (int i = 0; i < _toolBox.Tabs.Count; i++)
             *  for (int j = 0; j < _toolBox.Tabs[i].ItemCount; j++)
             *      if (((SchemaEditor.SchemaCommands.ToolCommand)_toolBox.Tabs[i][j].Object).IsActive)
             *      {
             *          _toolBox.Tabs[i].Selected = true;
             *          _toolBox.Tabs[i][j].Selected = true;
             *          _toolBox.Tabs[i].SelectedItem = _toolBox.Tabs[i][j];
             *      }
             *      else
             *      {
             *          _toolBox.Tabs[i].Selected = false;
             *          _toolBox.Tabs[i][j].Selected = false;
             *      }
             */
            _toolBox.Update();
        }
예제 #10
0
        public MainForm()
        {
            InitializeComponent();

            //填写状态栏信息
            toolStripStatusLabel.Text             = "已登陆";
            toolStripStatususeridtext.Text        = Pubvar.gu8userdata.UserId;
            toolStripStatuscompanytext.Text       = "[" + Pubvar.gu8userdata.AccID + "]" + Pubvar.gu8userdata.AccName;
            toolStripStatusoperationdatetext.Text = Pubvar.gu8userdata.operDate;

            //构建左侧菜单栏并设置基本属性
            u8toolBox.BackColor         = System.Drawing.SystemColors.Control;
            u8toolBox.Dock              = System.Windows.Forms.DockStyle.Fill;
            u8toolBox.TabHeight         = 18;
            u8toolBox.ItemHeight        = 20;
            u8toolBox.ItemSpacing       = 1;
            u8toolBox.ItemHoverColor    = System.Drawing.Color.OldLace;
            u8toolBox.ItemNormalColor   = System.Drawing.SystemColors.Control;
            u8toolBox.ItemSelectedColor = System.Drawing.Color.BurlyWood;

            //创建tab菜单项 -- U8数据接口
            ToolBoxTab _tab_u8datainterface = new ToolBoxTab("U8数据接口", 1);

            _tab_u8datainterface.SmallImageIndex = 2;
            u8toolBox.AddTab(_tab_u8datainterface);
            //创建tab菜单项下子菜单项 -- U8数据接口 -- 数据导入
            ToolBoxItem _itemdataimport = new ToolBoxItem();

            _itemdataimport.Caption         = "数据导入";
            _itemdataimport.Enabled         = true;
            _itemdataimport.AllowDrag       = false;
            _itemdataimport.SmallImageIndex = 1;
            _itemdataimport.Object          = new Rectangle(10, 10, 100, 100);
            u8toolBox[0].AddItem(_itemdataimport);
            _itemdataimport.Selected = false;
            //隐藏tab control 及标签页
            U8tabCtl.Visible           = false;
            U8dataimporttabPage.Parent = null;
        }
예제 #11
0
        private void SelectionUIOverlay_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            ToolBoxItem DragData = (ToolBoxItem)e.Data.GetData(typeof(ToolBoxItem));
            Control     ctrl     = ControlFactory.CreateControl(DragData.Caption, DragData.Object.ToString()) as Control;

            ctrl.Location = m_Form.PointToClient(new Point(e.X, e.Y));
            if (!(ctrl is DateTimePicker))            //DateTimePicker can not set Text property
            {
                ctrl.Text = DragData.Caption;
            }
            Rectangle rect = ctrl.Bounds;

            rect = m_Form.RectangleToScreen(rect);
            rect = this.RectangleToClient(rect);

            m_Form.Controls.Add(ctrl);
            ctrl.BringToFront();
            m_tracker.m_rect = rect;
            m_seletedCtrl    = ctrl;
            m_FormTracker.Clear();
            MainForm.m_propertyWindow.SetSelectedObject(ctrl);

            InvalidateEx();
        }
예제 #12
0
 public void Handle(ToolBoxItem message)
 {
     this.tbi = message;
 }
예제 #13
0
        private ContextMenu CreateContextMenu(bool forTab, ToolBoxItem item)
        {
            ToolBoxTab  theTab = null;
            ContextMenu cm     = new ContextMenu();

            cm.MenuItems.Add(forTab ? "ToolBox Tab Menu" : "ToolBox Item Menu");
            cm.MenuItems.Add(item.Caption);

            cm.MenuItems.Add("-");
            cm.MenuItems.Add("Rename " + (forTab ? "Tab" : "Item"));         //3 - Rename
            cm.MenuItems.Add("Move " + (forTab ? "Tab" : "Item") + " up");   //4 - Move up
            cm.MenuItems.Add("Move " + (forTab ? "Tab" : "Item") + " down"); //5 - Move down
            cm.MenuItems.Add("Delete " + (forTab ? "Tab" : "Item"));         //6 - Delete

            cm.MenuItems[0].Enabled = false;

            if (forTab)
            {
                theTab = (ToolBoxTab)item;
            }
            else
            {
                theTab = (ToolBoxTab)item.ParentItem;
            }

            cm.MenuItems[3].Enabled = item.Renamable;
            cm.MenuItems[4].Enabled = item.CanMoveUp;
            cm.MenuItems[5].Enabled = item.CanMoveDown;
            cm.MenuItems[6].Enabled = item.Deletable;

            if (!forTab)
            {
//                 cm.MenuItems[3].Click += new EventHandler(OnItemRenameClick);
//                 cm.MenuItems[4].Click += new EventHandler(OnItemMoveUpClick);
//                 cm.MenuItems[5].Click += new EventHandler(OnItemMoveDownClick);
//                 cm.MenuItems[6].Click += new EventHandler(OnItemDeleteClick);
            }
            else
            {
//                 cm.MenuItems[3].Click += new EventHandler(OnTabRenameClick);
//                 cm.MenuItems[4].Click += new EventHandler(OnTabMoveUpClick);
//                 cm.MenuItems[5].Click += new EventHandler(OnTabMoveDownClick);
//                 cm.MenuItems[6].Click += new EventHandler(OnTabDeleteClick);
            }

            if (!forTab)
            {
                editedItem = item;
            }
            else
            {
            }

            if (null != theTab)
            {
                MenuItem[] subMenus = new MenuItem[3];

                subMenus[0] = new MenuItem("List");
                subMenus[1] = new MenuItem("Small Icons");
                subMenus[2] = new MenuItem("Large Icons");


                cm.MenuItems.Add("-");
                cm.MenuItems.Add("View", subMenus);

                switch (theTab.View)
                {
                case ViewMode.List:
                    subMenus[0].Checked = true;
                    break;

                case ViewMode.SmallIcons:
                    subMenus[1].Checked = true;
                    break;

                case ViewMode.LargeIcons:
                    subMenus[2].Checked = true;
                    break;
                }

                subMenus[0].Click += new EventHandler(OnItemViewModeChange);
                subMenus[1].Click += new EventHandler(OnItemViewModeChange);
                subMenus[2].Click += new EventHandler(OnItemViewModeChange);
            }

            editedTab = theTab;

            cm.MenuItems.Add("-");

            cm.MenuItems.Add("Sample Menu Item 1");
            cm.MenuItems.Add("Sample Menu Item 2");


            return(cm);
        }
예제 #14
0
        /// <summary>
        /// Activate an item in the toolbox
        /// </summary>
        /// <param name="DTE">DTE object</param>
        /// <param name="tabName">The toolbox tab name</param>
        /// <param name="itemName">The item name in that tab</param>
        /// <returns>true if the item has been activated</returns>
        public static bool ActivateToolboxItem(DTE2 DTE, string tabName, string itemName)
        {
            DTE.ExecuteCommand("View.Toolbox", "");
            ToolBox    toolbox = DTE.ToolWindows.ToolBox;
            ToolBoxTab tab     = toolbox.ToolBoxTabs.Item(tabName);

            if (tab != null)
            {
                tab.Activate();
                ToolBoxItem  foundItem         = null;
                int          foundItemIndex    = -1;
                int          selectedItemIndex = -1;
                ToolBoxItems items             = tab.ToolBoxItems;
                ToolBoxItem  selectedItem      = items.SelectedItem;
                foreach (ToolBoxItem currentItem in items)
                {
                    if (foundItem == null)
                    {
                        ++foundItemIndex;
                        if (currentItem.Name == itemName)
                        {
                            foundItem = currentItem;
                            if (selectedItem == null)
                            {
                                break;
                            }
                        }
                    }
                    if (selectedItem != null)
                    {
                        ++selectedItemIndex;
                        if (selectedItem == currentItem)
                        {
                            selectedItem = null;
                            if (foundItem != null)
                            {
                                break;
                            }
                        }
                    }
                }
                if (foundItem != null)
                {
                    int distance = foundItemIndex - selectedItemIndex;
                    if (distance != 0)
                    {
                        SendKeys.Flush();
                        if (distance > 0)
                        {
                            SendKeys.SendWait(string.Format("{{DOWN {0}}}", distance));
                        }
                        else
                        {
                            SendKeys.SendWait(string.Format("{{UP {0}}}", -distance));
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #15
0
        public void UpdateCurrentToolBoxItem(ToolBoxItem toolBoxItem)
        {
            this.currentToolBoxItem = toolBoxItem;

            this.UpdateUmlConnectors();
        }
예제 #16
0
 private void UpdateCurrentToolBoxItem(ToolBoxItem toolBoxItem)
 {
     this.umlDesignerCanvas.UpdateCurrentToolBoxItem(toolBoxItem);
 }
 public DragSelectedItemEvent(ToolBoxItem tbi)
 {
     FullImageName = tbi.FullImageName;
     ImageHeight   = tbi.ImageHeight;
     ImageWidth    = tbi.ImageWidth;
 }
예제 #18
0
        public void NotifySelectAction(ToolBoxItem toolBoxItem)
        {
            this.SelectToolBoxItem(toolBoxItem);

            this.UpdateCurrentToolBoxItem(toolBoxItem);
        }
예제 #19
0
 private void SelectToolBoxItem(ToolBoxItem toolBoxItem)
 {
     this.UnselectAllToolBoxItems();
     this.thingsToolbox.SelectToolBoxItem(toolBoxItem);
     this.relationshipsToolbox.SelectToolBoxItem(toolBoxItem);
 }
예제 #20
0
 private void toolBox1_ItemSelectionChanged(ToolBoxItem sender, EventArgs e)
 {
     this.SpriteContextMenuStrip.Enabled = this.toolBox1.SelectedTab != null && this.toolBox1.SelectedTab.SelectedItem != null && this.toolBox1.SelectedTab.SelectedItem.Object is Sprite;
 }
예제 #21
0
        public UmlDesignerCanvas()
        {
            this.Background         = Brushes.GhostWhite;
            this.Cursor             = Cursors.Cross;
            this.currentToolBoxItem = ToolBoxItem.Undefined;

            this.umlConnectorHandlers = new List <UmlConnectorHandler>();

            MouseLeftButtonDown += (sender, eventArgs) =>
            {
                this.initialMousePosition = eventArgs.GetPosition(this);

                switch (this.currentToolBoxItem)
                {
                case ToolBoxItem.Class: {
                    this.AddUmlClassControl();
                }; break;

                case ToolBoxItem.Interface: {
                    this.AddUmlInterfaceControl();
                }; break;

                case ToolBoxItem.Generalization:
                {
                }; break;

                default: this.DisplayAlertMessage("You have to select a ToolBoxItem first!"); break;
                }
            };

            MouseUp += (sender, eventArgs) =>
            {
                Point mousePosition = eventArgs.GetPosition(this);
                switch (this.currentToolBoxItem)
                {
                case ToolBoxItem.Generalization:
                {
                    this.AddUmlGeneralizationControl(mousePosition);
                }; break;

                case ToolBoxItem.Composition:
                {
                    this.DisplayAlertMessage("To be implemented!");
                }; break;

                case ToolBoxItem.Aggregation:
                {
                    this.DisplayAlertMessage("To be implemented!");
                }; break;

                case ToolBoxItem.Association:
                {
                    this.DisplayAlertMessage("To be implemented!");
                }; break;

                case ToolBoxItem.Dependency:
                {
                    this.DisplayAlertMessage("To be implemented!");
                }; break;

                default: { } break;
                }

                this.InvalidateMeasure();
            };
        }