示例#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
        private void InitUserTool(ToolsDesign toolDesign)
        {
            try
            {
                for (int i = toolStrip1.Items.Count - 1; i >= 0; i--)
                {
                    //先移除用户控件
                    if (toolStrip1.Items[i].Tag == null)
                    {
                        continue;
                    }
                    toolStrip1.Items.RemoveAt(i);
                }

                if (toolDesign.ToolsCfg.Count <= 0)
                {
                    if (toolStrip1.Items.Count <= 0)
                    {
                        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);
            }
        }