Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="designer"></param>
        /// <param name="rootComponentType">it can be null. if not null then it must be a type derived from Diagram</param>
        public ItemDesignerHost(IXDesignerHost designer, Type rootComponentType)
        {
            InitializeComponent();
            _undoEngine = new UndoEngine2();
            if (rootComponentType == null)
            {
                dsf = new DesignSurface(typeof(Diagram));
            }
            else
            {
                dsf = new DesignSurface(rootComponentType);
            }
            Control control = dsf.View as Control;

            this.Controls.Add(control);
            control.Dock    = DockStyle.Fill;
            control.Visible = true;
            //
            IDesignerHost host = (IDesignerHost)dsf.GetService(typeof(IDesignerHost));

            root      = (Diagram)host.RootComponent;
            root.Dock = DockStyle.Fill;
            //
            DesignMessageFilter filter = new DesignMessageFilter(dsf);

            Application.AddMessageFilter(filter);
        }
Example #2
0
 public ItemDesignerHost(IXDesignerHost designer)
     : this(designer, typeof(Diagram))
 {
 }