日期:2014-05-18 浏览次数:20941 次
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
namespace eWhereThink.Workflow.Design
{
    [Designer(typeof(DesignPanelDesigner), typeof(IRootDesigner))]
    [Designer(typeof(ComponentDesigner))]
    [ToolboxItem(false)]
    public class DesignPanel : Component
    {
        public DesignPanel()
        {
        }
    }
}
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace eWhereThink.Workflow.Design
{
    public class DesignPanelDesigner : ComponentDocumentDesigner, IRootDesigner
    {
        DesignControl _rootViewControl;
        public DesignPanelDesigner()
        {
            
        }
        public object GetView(ViewTechnology technology)
        {
            _rootViewControl = new DesignControl(this);
            return _rootViewControl;
        }
        public ViewTechnology[] SupportedTechnologies
        {
            get
            {
                return new ViewTechnology[] { ViewTechnology.Default };
            }
        }
        protected override bool GetToolSupported(ToolboxItem tool)
        {
            MessageBox.Show(tool.TypeName);
            return true;
        }
        public void ToolPicked(ToolboxItem tool)
        {
            MessageBox.Show(tool.TypeName + "     ToolPicked");
        }
    }
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
namespace eWhereThink.Workflow.Design
{
    [ToolboxItem(false)]
    public class DesignControl : ScrollableControl
    {
        private DesignPanelDesigner _rootDesigner;
        private IContainer components;
        private Hashtable _componentInfoTable;
        public DesignControl(DesignPanelDesigner rootDesigner)
        {
            InitializeComponent();
            _rootDesigner = rootDesigner;
            _componentInfoTable = new Hashtable();
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            this.Invalidate();
        }
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // DesignControl
            // 
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.DesignControl_Paint);
            this.ResumeLayout(false);
        }
        private void DesignControl_Paint(object sender, PaintEventArgs e)
        {
            float fZoom = 1F;
            Size size = new Size();
            size.Width = Math.Max(this.Width, this.AutoScrollMinSize.Width);
            size.Height = Math.Max(this.Height, this.AutoScrollMinSize.Height);
            Bit