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; } }
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; }