示例#1
0
        private void InitUserTool(ToolsDesign toolDesign)
        {
            try
            {
                //先移除用户控件
                toolStrip1.Items.Clear();


                if (toolDesign.ToolsCfg.Count <= 0)
                {
                    if (toolStrip1.Items.Count <= 0 && this.DesignMode == false)
                    {
                        toolStrip1.Visible = false;
                    }

                    return;
                }

                ToolsHelper.ConfigButtons(toolStrip1, toolDesign, DoUserToolEvent_StripItem);

                if (this.DesignMode == false)
                {
                    toolStrip1.Visible = (toolStrip1.Items.Count <= 0) ? false : true;
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#2
0
        public ToolsControl()
        {
            InitializeComponent();

            _toolsDesign = new ToolsDesign();

            _toolsDesign.Visible    = true;
            _toolsDesign.BackColor  = toolStrip1.BackColor;
            _toolsDesign.ForceColor = toolStrip1.ForeColor;
        }
示例#3
0
        protected override void ReloadCustomDesign(string customContext)
        {
            if (string.IsNullOrEmpty(customContext))
            {
                return;
            }

            _toolsDesign = JsonHelper.DeserializeObject <ToolsDesign>(customContext);

            toolStrip1.BackColor = _toolsDesign.BackColor;
            toolStrip1.ForeColor = _toolsDesign.ForceColor;

            if (_toolsDesign.ToolsCfg != null)
            {
                InitUserTool(_toolsDesign);
            }

            ToolsHelper.SyncDesignEventsByButtons(_toolsDesign, _designEvents);
        }