コード例 #1
0
        public void EnableDragandDrop()
        {
            // For the management of the drag and drop of the toolboxItems
            Control ctrl = this.GetView();

            if (null == ctrl)
            {
                return;
            }
            ctrl.AllowDrop = true;
            ctrl.DragDrop += new DragEventHandler(OnDragDrop);

            //- enable the Dragitem inside the our Toolbox
            ToolboxServiceImp tbs = this.GetIToolboxService();

            if (null == tbs)
            {
                return;
            }
            if (null == tbs.Toolbox)
            {
                return;
            }
            tbs.Toolbox.MouseDown += new MouseEventHandler(OnListboxMouseDown);
        }
コード例 #2
0
 //- The DesignSurface class provides several design-time services automatically.
 //- The DesignSurface class adds all of its services in its constructor.
 //- Most of these services can be overridden by replacing them in the
 //- protected ServiceContainer property.To replace a service, override the constructor,
 //- call base, and make any changes through the protected ServiceContainer property.
 private void InitServices()
 {
     //- each DesignSurface has its own default services
     //- We can leave the default services in their present state,
     //- or we can remove them and replace them with our own.
     //- Now add our own services using IServiceContainer
     //-
     //-
     //-
     _menuCommandService = new MenuCommandServiceExt(this);
     if (_menuCommandService != null)
     {
         //- remove the old Service, i.e. the DesignsurfaceExt service
         this.ServiceContainer.RemoveService(typeof(IMenuCommandService), false);
         //- add the new IMenuCommandService
         this.ServiceContainer.AddService(typeof(IMenuCommandService), _menuCommandService);
     }
     //-
     //-
     //- IToolboxService
     _toolboxService = new ToolboxServiceImp(this.GetIDesignerHost());
     if (_toolboxService != null)
     {
         this.ServiceContainer.RemoveService(typeof(IToolboxService), false);
         this.ServiceContainer.AddService(typeof(IToolboxService), _toolboxService);
     }
 }
コード例 #3
0
        public ToolboxServiceImp GetIToolboxService()
        {
            ToolboxServiceImp temp = (ToolboxServiceImp)this.GetService(typeof(IToolboxService));

            return(temp);
        }