/// <summary> /// Installs the scroll director and adds the appropriate handlers. /// </summary> /// <param name="scrollableControl"> /// The scrollable control on which this director directs. /// </param> /// <param name="view">The PCanvas that the scrollable control scrolls.</param> public virtual void Install(PScrollableControl scrollableControl, PCanvas view) { this.scrollableControl = scrollableControl; this.view = view; if (view != null) { this.camera = view.Camera; this.root = view.Root; } if (camera != null) { camera.ViewTransformChanged += new PPropertyEventHandler(camera_ViewTransformChanged); camera.BoundsChanged += new PPropertyEventHandler(camera_BoundsChanged); camera.FullBoundsChanged += new PPropertyEventHandler(camera_FullBoundsChanged); } if (root != null) { root.BoundsChanged += new PPropertyEventHandler(root_BoundsChanged); root.FullBoundsChanged += new PPropertyEventHandler(root_FullBoundsChanged); } if (scrollableControl != null) { scrollableControl.UpdateScrollbars(); } }
/// <summary> /// Uninstalls the scroll director from the scrollable control. /// </summary> public virtual void UnInstall() { scrollableControl = null; view = null; if (camera != null) { camera.ViewTransformChanged -= new PPropertyEventHandler(camera_ViewTransformChanged); camera.BoundsChanged -= new PPropertyEventHandler(camera_BoundsChanged); camera.FullBoundsChanged -= new PPropertyEventHandler(camera_FullBoundsChanged); } if (root != null) { root.BoundsChanged -= new PPropertyEventHandler(root_BoundsChanged); root.FullBoundsChanged -= new PPropertyEventHandler(root_FullBoundsChanged); } camera = null; root = null; }
/// <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 isLocal 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; }
/// <summary> /// Initializer for PCanvas /// </summary> void InitializeComponent() { this.OverviewContainer = new System.Windows.Forms.Panel(); this.ScrollContainer = new UMD.HCIL.PiccoloX.Components.PScrollableControl(); this.SuspendLayout(); // // OverviewContainer // this.OverviewContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OverviewContainer.BackColor = System.Drawing.Color.White; this.OverviewContainer.Location = new System.Drawing.Point(456, 312); this.OverviewContainer.Name = "OverviewContainer"; this.OverviewContainer.Size = new System.Drawing.Size(140, 140); this.OverviewContainer.TabIndex = 0; // // ScrollContainer // this.ScrollContainer.Dock = DockStyle.Fill; this.ScrollContainer.VsbPolicy = ScrollBarPolicy.Always; this.ScrollContainer.HsbPolicy = ScrollBarPolicy.Always; // // PathwayView // this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(622, 491); this.Controls.Add(this.OverviewContainer); this.Icon = global::Ecell.IDE.Plugins.PathwayWindow.PathwayResource.Icon_PathwayView; this.Name = "PathwayView"; this.TabText = global::Ecell.IDE.Plugins.PathwayWindow.MessageResources.WindowPathway; this.Text = global::Ecell.IDE.Plugins.PathwayWindow.MessageResources.WindowPathway; this.ResumeLayout(false); }