Changeset 2514 for trunk/sources/HeuristicLab.MainForm.WindowsForms
- Timestamp:
- 11/19/09 18:13:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/MainFormBase.cs
r2469 r2514 207 207 208 208 object[] items = ds.GetInstances(userInterfaceItemType); 209 IEnumerable< MenuItemBase> toolStripMenuItems =209 IEnumerable<IMenuItem> toolStripMenuItems = 210 210 from mi in items 211 where mi is MenuItemBase212 orderby (( MenuItemBase)mi).Position213 select ( MenuItemBase)mi;214 foreach ( MenuItemBasemenuItem in toolStripMenuItems)211 where mi is IMenuItem 212 orderby ((IMenuItem)mi).Position 213 select (IMenuItem)mi; 214 foreach (IMenuItem menuItem in toolStripMenuItems) 215 215 AddToolStripMenuItem(menuItem); 216 216 217 217 items = ds.GetInstances(userInterfaceItemType); 218 IEnumerable< ToolBarItemBase> toolStripButtonItems =218 IEnumerable<IToolBarItem> toolStripButtonItems = 219 219 from bi in items 220 where bi is ToolBarItemBase221 orderby (( ToolBarItemBase)bi).Position222 select ( ToolBarItemBase)bi;223 foreach ( ToolBarItemBasetoolStripButtonItem in toolStripButtonItems)220 where bi is IToolBarItem 221 orderby ((IToolBarItem)bi).Position 222 select (IToolBarItem)bi; 223 foreach (IToolBarItem toolStripButtonItem in toolStripButtonItems) 224 224 AddToolStripButtonItem(toolStripButtonItem); 225 225 } 226 226 227 private void AddToolStripMenuItem(MenuItemBase menuItem) { 228 ToolStripMenuItem item = new ToolStripMenuItem(); 229 SetToolStripItemProperties(item, menuItem); 230 menuItem.ToolStripItem = item; 231 item.ShortcutKeys = menuItem.ShortCutKeys; 232 item.DisplayStyle = menuItem.ToolStripItemDisplayStyle; 233 this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), item, menuStrip.Items); 234 } 235 236 private void AddToolStripButtonItem(ToolBarItemBase buttonItem) { 237 ToolStripItem item; 238 if (buttonItem.IsDropDownButton) 239 item = new ToolStripDropDownButton(); 240 else 241 item = new ToolStripButton(); 242 243 SetToolStripItemProperties(item, buttonItem); 244 item.DisplayStyle = buttonItem.ToolStripItemDisplayStyle; 245 buttonItem.ToolStripItem = item; 227 private void AddToolStripMenuItem(IMenuItem menuItem) { 228 if (menuItem is MenuItemBase) { 229 ToolStripMenuItem item = new ToolStripMenuItem(); 230 SetToolStripItemProperties(item, menuItem); 231 ((MenuItemBase)menuItem).ToolStripItem = item; 232 item.ShortcutKeys = ((MenuItemBase)menuItem).ShortCutKeys; 233 item.DisplayStyle = ((MenuItemBase)menuItem).ToolStripItemDisplayStyle; 234 this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), item, menuStrip.Items); 235 } else if (menuItem is MenuSeparatorItemBase) { 236 this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), new ToolStripSeparator(), menuStrip.Items); 237 } 238 } 239 240 private void AddToolStripButtonItem(IToolBarItem buttonItem) { 241 ToolStripItem item = null; 242 243 if (buttonItem is ToolBarItemBase) { 244 if (((ToolBarItemBase)buttonItem).IsDropDownButton) 245 item = new ToolStripDropDownButton(); 246 else 247 item = new ToolStripButton(); 248 249 SetToolStripItemProperties(item, buttonItem); 250 item.DisplayStyle = ((ToolBarItemBase)buttonItem).ToolStripItemDisplayStyle; 251 ((ToolBarItemBase)buttonItem).ToolStripItem = item; 252 } else if (buttonItem is IToolBarSeparatorItem) 253 item = new ToolStripSeparator(); 254 246 255 this.InsertItem(buttonItem.Structure, typeof(ToolStripDropDownButton), item, toolStrip.Items); 247 256 }
Note: See TracChangeset
for help on using the changeset viewer.