public HostSurface() : base() { this.AddService(typeof(IMenuCommandService), new MenuCommandService(this.ServiceContainer)); //You only need to do your own implementation if you want to do something special. this.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(this.ServiceContainer)); this.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService(this.ServiceContainer)); // AJOUT : UndoEngine UndoEngine undoEngine = new UndoEngineImpl(this.ServiceContainer); //- enable the UndoEngine undoEngine.Enabled = true; if (undoEngine != null) { //- the UndoEngine is ready to be replaced this.ServiceContainer.RemoveService(typeof(UndoEngine), false); this.ServiceContainer.AddService(typeof(UndoEngine), undoEngine); Menu = new MenuCommandServiceImpl(this.ServiceContainer); Menu.Designer = this; ServiceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), Menu); Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteUndo), StandardCommands.Undo)); Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteRedo), StandardCommands.Redo)); } }
public Designer(bool ShowGrid, bool EnableInSituEditing, bool UseSnapLines, bool UseOptimizedCodeGeneration, bool UseSmartTags, bool ObjectBoundSmartTagAutoShow, bool SnapToGrid) : base() { // Service de gestion du toolbox ServiceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), new Toolbox()); // ServiceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), new DesignerResourceService(this.resourceStore)); ServiceContainer.AddService(typeof(AmbientProperties), new AmbientProperties()); // Service de vue du concepteur // ServiceContainer.AddService(typeof(ViewService), new ViewService()); // Service de gestion des menus Menu = new MenuCommandServiceImpl(ServiceContainer); // AddHandler Me.Menu.OnExecuteViewCode, AddressOf Me.Menu_OnExecuteViewCode // AddHandler Me.Menu.OnExecuteViewProperty, AddressOf Me.Menu_OnExecuteViewProperty // AddHandler Me.Menu.OnExecuteCreateEvent, AddressOf Me.Menu_OnExecuteCreateEvent // AddHandler Me.Menu.OnSelectComponentEvent, AddressOf Me.Menu_OnSelectComponentEvent // Me.Menu.Designer = Me ServiceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), Menu); // On sp�cifie qu'on va utilser la grille pour placer les composants designerOptionService.CompatibilityOptions.ShowGrid = ShowGrid; designerOptionService.CompatibilityOptions.EnableInSituEditing = EnableInSituEditing; designerOptionService.CompatibilityOptions.UseSnapLines = UseSnapLines; designerOptionService.CompatibilityOptions.UseOptimizedCodeGeneration = UseOptimizedCodeGeneration; designerOptionService.CompatibilityOptions.UseSmartTags = UseSmartTags; designerOptionService.CompatibilityOptions.ObjectBoundSmartTagAutoShow = ObjectBoundSmartTagAutoShow; designerOptionService.CompatibilityOptions.SnapToGrid = SnapToGrid; ServiceContainer.AddService(typeof(System.ComponentModel.Design.DesignerOptionService), designerOptionService); }
private void AddTabForNewHost(string tabText) { System.ComponentModel.Design.IServiceContainer serviceContainer; Home.m_toolbox.toolbox1.DesignerHost = HostC.DesignerHost; // Dim tabpage As TabPage = New TabPage(tabText) // TabPage.Tag = CurrentMenuSelectionLoaderType HostC.Dock = DockStyle.Fill; // tabControl1.TabPages.Add(tabpage) // tabControl1.SelectedIndex = tabControl1.TabPages.Count - 1 _hostSurfaceManager.ActiveDesignSurface = HostC.HostSurface; // serviceContainer = (System.ComponentModel.Design.IServiceContainer)_hostSurfaceManager.GetService(typeof(System.ComponentModel.Design.ServiceContainer)); MenuCommandService = new Host.MenuCommandServiceImpl(_hostSurfaceManager); HostC.DesignerHost.AddService(typeof(System.ComponentModel.Design.MenuCommandService), MenuCommandService); // Ajout du service Annuler/Retablir undoEngine = new OSMaker.UndoEngineImpl(_hostSurfaceManager); undoEngine.Enabled = true; _hostSurfaceManager.AddService(typeof(System.ComponentModel.Design.UndoEngine), undoEngine); ISelectionService s = (ISelectionService)_hostSurfaceManager.GetService(typeof(ISelectionService)); s.SelectionChanged += new EventHandler(OnSelectionChanged); }
public void Annuler() { MenuCommandService = new Host.MenuCommandServiceImpl(_hostSurfaceManager); System.ComponentModel.Design.IMenuCommandService ims = HostC.HostSurface.GetService(typeof(System.ComponentModel.Design.IMenuCommandService)) as System.ComponentModel.Design.IMenuCommandService; var a = System.ComponentModel.Design.StandardCommands.Undo; ims.GlobalInvoke(a); }
public void CentrerVerticalement() { MenuCommandService = new Host.MenuCommandServiceImpl(_hostSurfaceManager); System.ComponentModel.Design.IMenuCommandService ims = HostC.HostSurface.GetService(typeof(System.ComponentModel.Design.IMenuCommandService)) as System.ComponentModel.Design.IMenuCommandService; var a = System.ComponentModel.Design.StandardCommands.CenterVertically; ims.GlobalInvoke(a); MenuCommandService.GlobalInvoke(a); }
public HostSurface(IServiceProvider parentProvider) : base(parentProvider) { Menu = new MenuCommandServiceImpl(this.ServiceContainer); Menu.Designer = this; ServiceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), Menu); Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteUndo), StandardCommands.Undo)); Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteRedo), StandardCommands.Redo)); // idem correction // this.AddService(typeof(IMenuCommandService), new MenuCommandService(this.ServiceContainer)); // Ajout : les 2 lignes de code suivantes. this.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(this.ServiceContainer)); this.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService(this.ServiceContainer)); this.AddService(typeof(UndoEngine), new UndoEngineImpl(this.ServiceContainer)); }