Пример #1
0
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);

            _DesignSurface         = new DesignSurface();
            _DesignSurface.Loaded += new LoadedEventHandler(OnDesignSurfaceLoaded);

            _ToolboxControl.AddToolboxItem(new ToolboxItem()
            {
                TypeName = NameConsts.Pointer, DisplayName = Properties.Resources.Tool_Pointer, Bitmap = new Bitmap(1, 1)
            });
            ToolMap.All(pair =>
            {
                _ToolboxControl.AddToolboxItem(new ToolboxItem(pair.Key)
                {
                    DisplayName = pair.Value
                });
                return(true);
            });

            DesignerHost = _DesignSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerHost.AddService(typeof(IToolboxService), _ToolboxControl.ToolboxService);
            //DesignerHost.AddService( typeof( IPropertyValueUIService ), new GlyphService() );

            SelectionService = _DesignSurface.GetService(typeof(ISelectionService)) as ISelectionService;
            SelectionService.SelectionChanged += OnDesignerSurfaceView_SelectionChanged;

            // Initialise the DesignSurface class
            _DesignSurface.BeginLoad(typeof(RootDesignedComponent));
        }