public MainFrm() { InitializeComponent(); Language.InitFormLanguage(this, StringResources.GetValue("lang")); ToolStripButtonGroup modeBtnGroup = new ToolStripButtonGroup(toolStrip); modeBtnGroup.AddButton(toolStripButton_BrowseMode); modeBtnGroup.AddButton(toolStripButton_EditLabelMode); modeBtnGroup.AddButton(toolStripButton_InputMode); modeBtnGroup.AddButton(toolStripButton_CheckMode); wsp_control_apt = new WorkspaceControlAdpter( modeBtnGroup, toolStripComboBox_File, TranslateTextBox, TextBox_GroupBox, new ListViewAdpter(listView, wsp.GroupDefine), picView, contextMenuStripQuickText, toolStrip, wsp); zoomAdaptor = new ZoomAdaptor(picView, toolStripButton_ZoomPlus, toolStripButton_ZoomMinus, toolStripComboBox_Zoom); langComboxApt = new LangComboxAdaptor(langToolStripComboBox, this); SetLayout(); }
public void Refresh(GroupDefineItemCollection groups) { myButtonGroup.DelAllButtons(); //清除当前按钮 buttonFont = new Font(toolStrip.Font.FontFamily, 12, toolStrip.Font.Style); for (int i = 1; i <= groups.UserGroupCount; i++) { ToolStripButton button = new ToolStripButton(); string title = groups.GetViewName(i); string fullTitle = groups.GetFullViewName(i); Color color = groups.GetColor(i); button.Font = buttonFont; button.ForeColor = color; button.Text = title; button.ToolTipText = fullTitle; myButtonGroup.AddButton(button); } if (myButtonGroup[0] != null) { myButtonGroup[0].Checked = true; } }