/// <include file='doc\CompositionCommandSet.uex' path='docs/doc[@for="CompositionCommandSet.CompositionCommandSet"]/*' /> /// <devdoc> /// Constructs a new composition command set object. /// </devdoc> public CompositionCommandSet(Control compositionUI, ISite site) : base(site) { Debug.Assert(compositionUI != null, "Null compositionUI passed into CompositionCommandSet"); this.compositionUI = compositionUI; // Establish our set of commands // commandSet = new CommandSetItem[] { // Keyboard commands new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySelect), MenuCommands.KeySelectNext), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySelect), MenuCommands.KeySelectPrevious), }; if (MenuService != null) { for (int i = 0; i < commandSet.Length; i++) { MenuService.AddCommand(commandSet[i]); } } }
/// <include file='doc\ControlCommandSet.uex' path='docs/doc[@for="ControlCommandSet.ControlCommandSet"]/*' /> /// <devdoc> /// Creates a new CommandSet object. This object implements the set /// of commands that the UI.Win32 form designer offers. /// </devdoc> public ControlCommandSet(ISite site) : base(site) { // Establish our set of commands // commandSet = new CommandSetItem[] { // Allignment commands new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignLeft), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignTop), new CommandSetItem( this, new EventHandler(OnStatusControlsOnlySelection), new EventHandler(OnMenuAlignToGrid), MenuCommands.AlignToGrid), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignBottom), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignHorizontalCenters), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignRight), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuAlignByPrimary), MenuCommands.AlignVerticalCenters), // Centering commands new CommandSetItem( this, new EventHandler(OnStatusControlsOnlySelection), new EventHandler(OnMenuCenterSelection), MenuCommands.CenterHorizontally), new CommandSetItem( this, new EventHandler(OnStatusControlsOnlySelection), new EventHandler(OnMenuCenterSelection), MenuCommands.CenterVertically), // Spacing commands new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.HorizSpaceConcatenate), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.HorizSpaceDecrease), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.HorizSpaceIncrease), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.HorizSpaceMakeEqual), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.VertSpaceConcatenate), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.VertSpaceDecrease), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.VertSpaceIncrease), new CommandSetItem( this, new EventHandler(OnStatusMultiSelect), new EventHandler(OnMenuSpacingCommand), MenuCommands.VertSpaceMakeEqual), // Sizing commands new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuSizingCommand), MenuCommands.SizeToControl), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuSizingCommand), MenuCommands.SizeToControlWidth), new CommandSetItem( this, new EventHandler(OnStatusMultiSelectPrimary), new EventHandler(OnMenuSizingCommand), MenuCommands.SizeToControlHeight), new CommandSetItem( this, new EventHandler(OnStatusControlsOnlySelection), new EventHandler(OnMenuSizeToGrid), MenuCommands.SizeToGrid), // Z-Order commands new CommandSetItem( this, new EventHandler(OnStatusZOrder), new EventHandler(OnMenuZOrderSelection), MenuCommands.BringToFront), new CommandSetItem( this, new EventHandler(OnStatusZOrder), new EventHandler(OnMenuZOrderSelection), MenuCommands.SendToBack), // Miscellaneous commands new CommandSetItem( this, new EventHandler(OnStatusShowGrid), new EventHandler(OnMenuShowGrid), MenuCommands.ShowGrid), new CommandSetItem( this, new EventHandler(OnStatusSnapToGrid), new EventHandler(OnMenuSnapToGrid), MenuCommands.SnapToGrid), new CommandSetItem( this, new EventHandler(OnStatusAnyControls), new EventHandler(OnMenuTabOrder), MenuCommands.TabOrder), new CommandSetItem( this, new EventHandler(OnStatusLockControls), new EventHandler(OnMenuLockControls), MenuCommands.LockControls), // Keyboard commands new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeySizeWidthIncrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeySizeHeightIncrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeySizeWidthDecrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeySizeHeightDecrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeyNudgeWidthIncrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeyNudgeHeightIncrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeyNudgeWidthDecrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySize), MenuCommands.KeyNudgeHeightDecrease), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySelect), MenuCommands.KeySelectNext), new CommandSetItem( this, new EventHandler(OnStatusAlways), new EventHandler(OnKeySelect), MenuCommands.KeySelectPrevious), }; if (MenuService != null) { for (int i = 0; i < commandSet.Length; i++) { MenuService.AddCommand(commandSet[i]); } } // Get the base control object. // IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); if (host != null) { IComponent comp = host.RootComponent; if (comp is Control) { baseControl = (Control)comp; } } }