protected override void AppendAdditionComponentMenuItems(ToolStripDropDown menu) { ToolStripMenuItem exceptionsItem = new ToolStripMenuItem(GetTransLation(new string[] { "Exceptions", "除去项" }), Properties.Resources.ExceptionIcon, exceptionClick); exceptionsItem.ToolTipText = GetTransLation(new string[] { "Except for the following selected component.", "除了以下选中的运算器。" }); exceptionsItem.Font = GH_FontServer.StandardBold; exceptionsItem.ForeColor = Color.FromArgb(19, 34, 122); void exceptionClick(object sender, EventArgs e) { CreateWindow(); } menu.Items.Add(exceptionsItem); GH_DocumentObject.Menu_AppendSeparator(menu); WinFormPlus.AddNumberBoxItem(menu, this, GetTransLation(new string[] { "Set Name FontSize", "设置命名字体大小" }), GetTransLation(new string[] { "Set the name box's font size.", "设置名称气泡框的字体大小。" }), ArchiTed_Grasshopper.Properties.Resources.TextIcon, true, _nameBoxFontSizeDefault, 4, 50, _nameBoxFontSize); WinFormPlus.ItemSet <Color>[] sets = new WinFormPlus.ItemSet <Color>[] { new WinFormPlus.ItemSet <Color>(GetTransLation(new string[] { "Text Color", "文字颜色" }), GetTransLation(new string[] { "Adjust text color.", "调整文字颜色。" }), null, true, _textColorDefault, _textColor), new WinFormPlus.ItemSet <Color>(GetTransLation(new string[] { "Background Color", "背景颜色" }), GetTransLation(new string[] { "Adjust background color.", "调整背景颜色。" }), null, true, _backgroundColorDefault, _backgroundColor), new WinFormPlus.ItemSet <Color>(GetTransLation(new string[] { "Boundary Color", "边框颜色" }), GetTransLation(new string[] { "Adjust boundary color.", "调整边框颜色。" }), null, true, _boundaryColorDefault, _boundaryColor), }; WinFormPlus.AddColorBoxItems(menu, this, GetTransLation(new string[] { "Colors", "颜色" }), GetTransLation(new string[] { "Adjust color.", "调整颜色。" }), ArchiTed_Grasshopper.Properties.Resources.ColorIcon, true, sets); }
/// <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 }; }