Beispiel #1
0
        /// <summary>
        ///     复制菜单项目StripButton
        /// </summary>
        /// <param name="orgMenuItem">原始的菜单</param>
        /// <returns>克隆的菜单StripButton</returns>
        public static ToolStripButton CloneFromMenuItem(this ToolStripMenuItem orgMenuItem)
        {
            var cloneButton = new ToolStripButton();
            //!!!typeof的参数必须是ToolStripMenuItem的基类!!!如果使用Control则不能取到值!!!
            //感谢CSDN网友beargo在帖子【如何获取事件已定制方法名?】里面的提示,网上的例子没有说明这个问题
            //坑爹啊。。。。。。。。
            var list = GetObjectEventList(orgMenuItem, "EventClick", typeof(ToolStripItem));

//            if (!SystemConfig.MonoMode)
//            {
            //悲催MONO不支持
            if (list != null && list[0] != null)
            {
                try
                {
                    cloneButton.Click += (x, y) => list[0].DynamicInvoke(x, y);
                }
                catch (Exception)
                {
                    //Utility.ExceptionDeal(ex);
                }
            }
            //          }
            cloneButton.Image   = orgMenuItem.Image;
            cloneButton.Enabled = orgMenuItem.Enabled;
            cloneButton.Text    = orgMenuItem.Text;
            if (GuiConfig.IsMono)
            {
                cloneButton.Font = GuiConfig.GetMonoFont(cloneButton.Font);
            }
            cloneButton.Checked      = orgMenuItem.Checked;
            cloneButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            return(cloneButton);
        }
Beispiel #2
0
        private void Main_Load(object sender, EventArgs e)
        {
            //选择器初始化
            ConfigItemDefine.SaveDefines();
            ctlConfFile.PickerType = CtlFilePicker.DialogType.SaveFile;
            ctlConfFile.FileFilter = Utility.ConfFilter;
            if (File.Exists(ConfigItemDefine.ValueFilename))
            {
                ConfigItemDefine.LoadValues();
            }
            RefreshSelectItemList();
            var cRoot        = ConfigItemDefine.LoadDefines();
            var rootTreeNode = new TreeNode("Config");

            FillTreeView(cRoot, rootTreeNode);
            trvConfig.Nodes.Add(rootTreeNode);
            trvConfig.ExpandAll();
            var MonoMode = Type.GetType("Mono.Runtime") != null;

            if (MonoMode)
            {
                this.Text = "Configuration File";
                this.Font = GuiConfig.GetMonoFont(this.Font);
            }
        }
Beispiel #3
0
        private void frmEditor_Load(object sender, EventArgs e)
        {
            var MonoMode = Type.GetType("Mono.Runtime") != null;

            if (MonoMode)
            {
                this.Font = GuiConfig.GetMonoFont(this.Font);
                this.Text = "Multi Language Editor";
            }
        }
Beispiel #4
0
        private void frmEditor_Load(object sender, EventArgs e)
        {
            var MonoMode = Type.GetType("Mono.Runtime") != null;

            if (MonoMode)
            {
                Font = GuiConfig.GetMonoFont(this.Font);
                Text = "Multi Language Editor";
            }
            cmbLanguage.SelectedIndexChanged += CmbLanguage_SelectedIndexChanged;
            lstMultiLan.DoubleClick          += LstMultiLan_DoubleClick;
        }
Beispiel #5
0
        /// <summary>
        ///     复制菜单项目
        /// </summary>
        /// <param name="orgMenuItem">原始的菜单</param>
        /// <returns>克隆的菜单</returns>
        public static ToolStripMenuItem Clone(this ToolStripMenuItem orgMenuItem)
        {
            var cloneMenuItem = new ToolStripMenuItem();
            //!!!typeof的参数必须是ToolStripMenuItem的基类!!!如果使用Control则不能取到值!!!
            //感谢CSDN网友beargo在帖子【如何获取事件已定制方法名?】里面的提示,网上的例子没有说明这个问题
            //坑爹啊。。。。。。。。
            var list = GetObjectEventList(orgMenuItem, "EventClick", typeof(ToolStripItem));

//            if (!SystemConfig.MonoMode)
//            {
            //悲催MONO不支持
            if (list != null && list[0] != null)
            {
                try
                {
                    cloneMenuItem.Click += (x, y) => list[0].DynamicInvoke(x, y);
                }
                catch (Exception)
                {
                    //Utility.ExceptionDeal(ex, cloneMenuItem.Text);
                }
            }
//            }
            cloneMenuItem.Text = orgMenuItem.Text;
            if (GuiConfig.IsMono)
            {
                cloneMenuItem.Font = GuiConfig.GetMonoFont(cloneMenuItem.Font);
            }
            cloneMenuItem.Enabled         = orgMenuItem.Enabled;
            cloneMenuItem.BackgroundImage = orgMenuItem.BackgroundImage;
            cloneMenuItem.Image           = orgMenuItem.Image;
            //子菜单的复制
            foreach (ToolStripMenuItem item in orgMenuItem.DropDownItems)
            {
                cloneMenuItem.DropDownItems.Add(item.Clone());
            }
            return(cloneMenuItem);
        }