예제 #1
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();
        }
예제 #2
0
        /// <summary>
        /// Sets up the form, sizing and anchoring the canvas.
        /// </summary>
        /// <param name="fullScreenMode">
        /// Indicates whether or not to start up in full screen mode.
        /// </param>
        /// <param name="aCanvas">
        /// The canvas to add to this PForm; can be null.
        /// </param>
        public void InitializePiccolo(bool fullScreenMode, PCanvas aCanvas)
        {
            if (aCanvas == null)
            {
                canvas = new PCanvas();
            }
            else
            {
                canvas = aCanvas;
            }

            canvas.Focus();
            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            = ClientSize;
            scrollableControl.Size = ClientSize;
            this.Controls.Add(scrollableControl);

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

            this.ResumeLayout(false);

            FullScreenMode = fullScreenMode;
        }