Exemplo n.º 1
0
        private DesignSurfaceExt2 CreateDesignSurface()
        {
            //- step.0
            //- create a DesignSurface and put it inside a Form in DesignTime
            DesignSurfaceExt2  surface = this._mgr.CreateDesignSurfaceExt2();
            IDesignSurfaceExt2 isurf   = (IDesignSurfaceExt2)surface;

            //- step.1
            //- enable the UndoEngines
            isurf.GetUndoEngineExt().Enabled = true;
            //- step.2
            //- try to get a ptr to ISelectionService interface
            //- if we obtain it then hook the SelectionChanged event
            ISelectionService selectionService = (ISelectionService)(isurf.GetIDesignerHost().GetService(typeof(ISelectionService)));

            if (null != selectionService)
            {
                selectionService.SelectionChanged += new System.EventHandler(OnSelectionChanged);
            }
            //- step.3
            //- Select the service IToolboxService
            //- and hook it to our ListBox
            ToolboxServiceImp tbox = isurf.GetIToolboxService() as ToolboxServiceImp;

            if (null != tbox)
            {
                tbox.Toolbox = listBox1;
            }
            //-
            //- finally return the Designsurface
            return(surface);
        }
Exemplo n.º 2
0
        public void RedoOnDesignSurface()
        {
            IDesignSurfaceExt2 isurf = DesignSurfaceManager.ActiveDesignSurface;

            if (null != isurf)
            {
                isurf.GetUndoEngineExt().Redo();
            }
        }