Exemplo n.º 1
0
        public DesignControl()
        {
            InitializeComponent();

            _relateBizModules = new CoordinationBizModules();

            _provideActionDesc = new Dictionary <string, string>();
            _provideDataDesc   = new ModuleDataDescription();

            _designEvents = new Dictionary <string, EventActionReleation>();

            _rclickMenus = new ModuleMenus();

            //Load -= DesignControl_Load;
            //Load += DesignControl_Load;
            try
            {
                InitBaseInfo();
            }
            catch (Exception ex)
            {
                throw new Exception("[InitBaseInfo] 模块信息初始化错误", ex);
            }

            _OriginalName = _moduleName;

            HandleDestroyed += EventHandlerProcess;
        }
Exemplo n.º 2
0
        private void InitRClickMenu(ModuleMenus rclickMenu)
        {
            try
            {
                if (this.ContextMenuStrip == null)
                {
                    return;
                }

                Font bFont = new Font(this.Font.FontFamily, (float)10.5, FontStyle.Bold);

                //添加用户工具按钮
                foreach (ModuleMenuInfo menuItem in rclickMenu.Menus)
                {
                    //创建快捷按钮
                    ToolStripItem rClickMenu = null;

                    if (menuItem.Name == "-")
                    {
                        rClickMenu = new ToolStripSeparator();
                    }
                    else
                    {
                        ToolStripMenuItem curMenu = new ToolStripMenuItem();

                        curMenu.Name   = menuItem.Name;
                        curMenu.Image  = Img24Resource.LoadImg(menuItem.Icon);
                        curMenu.Text   = menuItem.Name + ((string.IsNullOrEmpty(menuItem.Shortcutkey)) ? "" : "(&" + menuItem.Shortcutkey + ")");
                        curMenu.Click += DoRClickMenuEvent;

                        rClickMenu = curMenu;
                    }

                    rClickMenu.Tag = menuItem;

                    if (string.IsNullOrEmpty(menuItem.ParentName))
                    {
                        this.ContextMenuStrip.Items.Add(rClickMenu);
                    }
                    else
                    {
                        ToolStripItem[] tsiParent = this.ContextMenuStrip.Items.Find(menuItem.ParentName, true);

                        ToolStripMenuItem dropDownMenu = tsiParent[0] as ToolStripMenuItem;

                        if (dropDownMenu != null)
                        {
                            dropDownMenu.DropDownItems.Add(rClickMenu);
                        }
                    }

                    menuItem.LinkMenu = rClickMenu;
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
        public bool ShowDesign(ModuleMenus rclickMenus, IWin32Window owner)
        {
            _rMenus = rclickMenus;

            this.ShowDialog(owner);

            return(_isOk);
        }
Exemplo n.º 4
0
        protected virtual void ReloadRClickMenu(string rclickMenuFmt)
        {
            ClearCustomRClickMenu();

            if (string.IsNullOrEmpty(rclickMenuFmt))
            {
                return;
            }

            _rclickMenus = JsonHelper.DeserializeObject <ModuleMenus>(rclickMenuFmt);

            if (_rclickMenus.Menus.Count <= 0)
            {
                return;
            }

            InitRClickMenu(_rclickMenus);

            SyncDesignEventsByRClickMenu();
        }