Example #1
0
        /// <summary>
        /// Construct a canvas with the basic scene graph consisting of a root, camera,
        /// and layer. Event handlers for zooming and panning are automatically
        /// installed.
        /// </summary>
        public PCanvas()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            CURRENT_PCANVAS          = this;
            cursorStack              = new Stack();
            Camera                   = CreateBasicScenegraph();
            DefaultRenderQuality     = RenderQuality.HighQuality;
            AnimatingRenderQuality   = RenderQuality.LowQuality;
            InteractingRenderQuality = RenderQuality.LowQuality;
            PanEventHandler          = new PPanEventHandler();
            ZoomEventHandler         = new PZoomEventHandler();
            BackColor                = Color.White;

                        #if (!WEB_DEPLOY)
            AllowDrop = true;
                        #endif

            RegionManagement = true;

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.Selectable, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        }
Example #2
0
        /// <summary>
        /// Construct a canvas with the basic scene graph consisting of a root, camera,
        /// and layer. Event handlers for zooming and panning are automatically
        /// installed.
        /// </summary>
        public PCanvas()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            CURRENT_PCANVAS          = this;
            cursorStack              = new Stack();
            Camera                   = PUtil.CreateBasicScenegraph();
            DefaultRenderQuality     = RenderQuality.HighQuality;
            AnimatingRenderQuality   = RenderQuality.LowQuality;
            InteractingRenderQuality = RenderQuality.LowQuality;
            //PanEventHandler = new PPanEventHandler();
            ZoomEventHandler = new PZoomEventHandler();
            //BackColor = Color.White;
            //AllowDrop = true;

            //SetStyle(ControlStyles.DoubleBuffer, true);
            //SetStyle(ControlStyles.Selectable, true);
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            realGraphics      = CreateGraphics();
            offscreenBitmap   = new Bitmap(ClientSize.Width, ClientSize.Height);           // 240, 294);
            offscreenGraphics = Graphics.FromImage(offscreenBitmap);
        }