示例#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                   = 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);
        }
示例#2
0
        //****************************************************************
        // Scene Graph - Methods for constructing the scene graph.
        //****************************************************************

        /// <summary>
        /// Override this method to modify the way the scene graph is created.
        /// </summary>
        /// <returns>The main camera node in the new scene graph.</returns>
        protected virtual PCamera CreateBasicScenegraph()
        {
            return(PUtil.CreateBasicScenegraph());
        }