예제 #1
0
 public override void CreateWindow()
 {
     WinformControlHelper.CreateWindow(Activator.CreateInstance(this.WindowsType, this) as LangWindow, this);
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the MyComponent1 class.
        /// </summary>
        public InfoGlassesComponent()
            : base(GetTransLation(new string[] { "InfoGlasses", "信息眼镜" }), GetTransLation(new string[] { "Info", "信息" }),
                   GetTransLation(new string[] { "To show the components' advances information.Right click to have advanced options", "显示电池的高级信息。右键可以获得更多选项。" }),
                   "Params", "Showcase Tools", windowsType: typeof(ExceptionWindow))
        {
            LanguageChanged += ResponseToLanguageChanged;
            ResponseToLanguageChanged(this, new EventArgs());

            int    width = 24;
            PointF changeInput;
            var    inputFuncs = WinformControlHelper.GetInnerRectLeftFunc(1, 2, new SizeF(width, width), out changeInput);

            this.InputLayoutMove = changeInput;

            PointF changeOutput;
            var    outputFuncs = WinformControlHelper.GetInnerRectRightFunc(1, 2, new SizeF(width, width), out changeOutput);

            this.OutputLayoutMove = changeOutput;

            ClickButtonIcon <LangWindow> NameButton = new ClickButtonIcon <LangWindow>(_showName, this, inputFuncs(1), true, Properties.Resources.ShowName, _showNameDefault,
                                                                                       tips: new string[] { "Click to choose whether to show the component's name.", "点击以选择是否要显示运算器的名称。" },
                                                                                       createMenu: () =>
            {
                ContextMenuStrip menu = new ContextMenuStrip()
                {
                    ShowImageMargin = true
                };
                WinFormPlus.AddLabelItem(menu, GetTransLation(new string[] { "Name Options", "名称选项" }));


                WinFormPlus.AddCheckBoxItem(menu, GetTransLation(new string[] { "Show NickName", "展示昵称" }), GetTransLation(new string[] { "When checked, it will show the nickname instead of name of the component.", "当选中时,将会显示运算器的昵称而不是全名。" }),
                                            null, this, _showNickName, _showNickNameDefault);
                WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Set Name Distance", "设置命名距离" }), GetTransLation(new string[] { "Set the distance between name box's top and the component's buttom.", "设置名称气泡框到运算器的距离。" }),
                                             ArchiTed_Grasshopper.Properties.Resources.DistanceIcon, true, _nameBoxDistanceDefault, 0, 500, _nameBoxDistance);
                return(menu);
            });


            ClickButtonIcon <LangWindow> CateButton = new ClickButtonIcon <LangWindow>(_cateSetName, this, inputFuncs(0), true, Properties.Resources.Category, _cateDefaultValue,
                                                                                       tips: new string[] { "Click to choose whether to show the component's category.", "点击以选择是否要显示运算器的类别位置。" },
                                                                                       createMenu: () =>
            {
                ContextMenuStrip menu = new ContextMenuStrip()
                {
                    ShowImageMargin = true
                };
                WinFormPlus.AddLabelItem(menu, GetTransLation(new string[] { "Category Options", "类别选项" }));
                WinFormPlus.AddCheckBoxItem(menu, GetTransLation(new string[] { "Full Name Category", "全名显示运算器类别" }), GetTransLation(new string[] { "When checked, it will show full name of category on box.", "当选中时,将会在每个运算器的顶部显示其类别的全名。" }),
                                            null, this, _fullCategory, _fullCateDefault);

                WinFormPlus.AddCheckBoxItem(menu, GetTransLation(new string[] { "Merge Category Box", "合并显示类别气泡框" }), GetTransLation(new string[] { "When checked, it will merge two boxes as one.", "当选中时, 每个运算器上显示类别的气泡框将会合成一个。" }),
                                            null, this, _mergeCateBox, _mergeCateDefault);

                return(menu);
            });
            ClickButtonIcon <LangWindow> AssemButton = new ClickButtonIcon <LangWindow>(_assemSetName, this, outputFuncs(0), true, Properties.Resources.Assembly, _assemDefaultValue,
                                                                                        tips: new string[] { "Click to choose whether to show the component's assembly.", "点击以选择是否要显示运算器的类库位置。" },
                                                                                        createMenu: () =>
            {
                ContextMenuStrip menu = new ContextMenuStrip()
                {
                    ShowImageMargin = true
                };
                WinFormPlus.AddLabelItem(menu, GetTransLation(new string[] { "Assembly Options", "类库选项" }));
                WinFormPlus.AddCheckBoxItem(menu, GetTransLation(new string[] { "Auto Assembly Height", "自动设置类库高度" }), GetTransLation(new string[] { "When checked, it will Automaticly change assembly's height.", "当选中时, 将会自动调整类库气泡框到运算器的距离。" }),
                                            null, this, _autoAssemHeight, _autoAssemHeightDefault);
                WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Set Assembly FontSize", "设置类库字体大小" }), GetTransLation(new string[] { "Set the assembly box's font size.", "设置类库气泡框的字体大小。" }), ArchiTed_Grasshopper.Properties.Resources.TextIcon,
                                             true, _assemFontSizeDefault, 4, 50, _assemFontSize);
                WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Set Assembly Width", "设置类库宽度" }), GetTransLation(new string[] { "Set the assembly box's width.", "设置类库气泡框的宽度。" }), ArchiTed_Grasshopper.Properties.Resources.SizeIcon,
                                             true, _assemBoxWidthDefault, 50, 1000, _assemBoxWidth);

                GH_DocumentObject.Menu_AppendSeparator(menu);

                WinFormPlus.AddCheckBoxItem(menu, GetTransLation(new string[] { "Avoid Profiler", "避开计时器" }), GetTransLation(new string[] { "When checked, it will Automaticly avoid profiler.", "当选中时,将会自动避开计时器。" }),
                                            null, this, _avoidProfiler, _avoidProDefault, this.IsAutoAssem);

                GH_DocumentObject.Menu_AppendSeparator(menu);

                WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Set Assembly Distance", "设置类库距离" }), GetTransLation(new string[] { "Set the distance between assembly box's top and the component's buttom, whose unit is Line spacing.", "设置类库气泡框到运算器的距离,单位为行间距。" }),
                                             ArchiTed_Grasshopper.Properties.Resources.DistanceIcon, !this.IsAutoAssem, _assemBoxHeightDefault, 0, 64, _assemBoxHeight);
                return(menu);
            });
            ClickButtonIcon <LangWindow> pluginBUtton = new ClickButtonIcon <LangWindow>(_showPlugin, this, outputFuncs(1), true, Properties.Resources.PlugInIcon, _showPluginDefault,
                                                                                         tips: new string[] { "Click to choose whether to show if the componet is plugin.", "点击以选择是否要显示运算器是否是插件。" },
                                                                                         createMenu: () =>
            {
                ContextMenuStrip menu = new ContextMenuStrip()
                {
                    ShowImageMargin = true
                };
                WinFormPlus.AddLabelItem(menu, GetTransLation(new string[] { "Plug-in Options", "插件选项" }));
                WinFormPlus.AddColorBoxItem(menu, this, GetTransLation(new string[] { "Highlight Color", "高亮显示颜色" }), GetTransLation(new string[] { "Modify the highlight color.", "修改高亮显示颜色。" }),
                                            ArchiTed_Grasshopper.Properties.Resources.ColorIcon, true, _pluginColorDefault, _pluginColor);

                WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Highlight Radius", "高亮显示半径" }), GetTransLation(new string[] { "Modify the highlight corner radius.", "修改高亮显示导角半径。" }),
                                             ArchiTed_Grasshopper.Properties.Resources.SizeIcon, true, _highLightRadiusDefault, 2, 100, _highLightRadius);

                return(menu);
            });

            this.Controls = new IRespond[] { NameButton, CateButton, AssemButton, pluginBUtton };
        }