Пример #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);
        }
 /// <summary>
 /// Process the given windows event from the camera.
 /// </summary>
 /// <param name="e">The windows event to be processed.</param>
 /// <param name="type">The type of windows event being processed.</param>
 /// <param name="camera">The camera from which to process the windows event.</param>
 /// <param name="canvas">The source of the windows event being processed.</param>
 public virtual void ProcessEventFromCamera(EventArgs e, PInputType type, PCamera camera, PCanvas canvas)
 {
     nextInput         = e;
     nextType          = type;
     nextInputSource   = camera;
     nextWindowsSource = canvas;
     camera.Root.ProcessInputs();
 }
Пример #3
0
        public PForm(PCanvas aCanvas)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            if (aCanvas == null) {
                canvas = new PCanvas();
            } else {
                canvas = aCanvas;
            }

            BeforeInitialize();

            //scrollableControl = new PScrollableControl(canvas);
            //AutoScrollCanvas = false;

            //Note: If the main application form, generated by visual studio, is set to
            //extend PForm, the InitializeComponent will set the bounds after this statement
            //Bounds = DefaultFormBounds;

            //this.SuspendLayout();
            canvas.Size = DefaultCanvasSize;
            //scrollableControl.Size = ClientSize;
            //this.Controls.Add(scrollableControl);

            //scrollableControl.Anchor =
            //	AnchorStyles.Bottom |
            //	AnchorStyles.Top |
            //	AnchorStyles.Left |
            //	AnchorStyles.Right;

            this.Controls.Add(canvas);
            //this.ResumeLayout(false);

            //FullScreenMode = fullScreenMode;

            //Force visible
            //this.Visible = true;
            //this.Refresh();

            //Necessary to invalidate the bounds because the state will be incorrect since
            //the message loop did not exist when the inpts were scheduled.
            //this.canvas.Root.InvalidateFullBounds();
            //this.canvas.Root.InvalidatePaint();

            //this.processDelegate = new ProcessDelegate(Initialize);
            //canvas.Invoke(processDelegate);

            canvas.Focus();
            Initialize();
        }
Пример #4
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);
        }
Пример #5
0
 /// <summary>
 /// Process the given windows event from the camera.
 /// </summary>
 /// <param name="e">The windows event to be processed.</param>
 /// <param name="type">The type of windows event being processed.</param>
 /// <param name="camera">The camera from which to process the windows event.</param>
 /// <param name="canvas">The source of the windows event being processed.</param>
 public virtual void ProcessEventFromCamera(EventArgs e, PInputType type, PCamera camera, PCanvas canvas)
 {
     nextInput = e;
     nextType = type;
     nextInputSource = camera;
     nextWindowsSource = canvas;
     camera.Root.ProcessInputs();
 }