void ViewStyleMenuItemClick(object sender, EventArgs e) { EnumToolStripMenuItem item = sender as EnumToolStripMenuItem; if (item != null && item.Value is VisualStyleType) { ChangeViewStyleTo((VisualStyleType)item.Value); } }
// pass a view style you want, the gs view will update to it public void ChangeViewStyleTo(VisualStyleType vs) { VisualStyle oldVs = mPreviewCtrl.mpView.VisualStyle; mPreviewCtrl.mpView.VisualStyle = new VisualStyle(vs); if (oldVs != null) { oldVs.Dispose(); } EnumToolStripMenuItem.UpdateCheckedState(viewStyleToolStripMenuItem.DropDown.Items, vs); refreshView(); }
void InitializeViewStyleMenuItems() { viewStyleToolStripMenuItem.DropDown.Items.AddRange( EnumToolStripMenuItem.CreateItems <VisualStyleType>(ViewStyleMenuItemClick)); }