internal ThumbnailViewForm(Control baseControl, DiagramClientView diagramClientView) { if (baseControl == null) { throw new ArgumentNullException("baseControl"); } if (diagramClientView == null) { throw new ArgumentNullException("diagramClientView"); } // Initialize the form. this.TopMost = true; this.ShowInTaskbar = false; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; // Position form so that its center lines up with the center of thumbnail control // at designer's bottom-right corner. Point location = baseControl.PointToScreen(new Point(baseControl.Width / 2, baseControl.Height / 2)); location.Offset(-ViewSize / 2, -ViewSize / 2); this.Bounds = new Rectangle(location.X, location.Y, ViewSize, ViewSize); // Make sure thumbnail form fits the screen and doesn't go below or off the right // edge of the screen. Rectangle screenBounds = Screen.FromControl(diagramClientView).WorkingArea; if (this.Right > screenBounds.Right) { this.Left = screenBounds.Right - this.Width; } if (this.Bottom > screenBounds.Bottom) { this.Top = screenBounds.Bottom - this.Height; } // Initialize a panel to host pan/zoom control. Panel panel1 = new Panel(); panel1.Dock = DockStyle.Fill; panel1.BorderStyle = BorderStyle.FixedSingle; this.Controls.Add(panel1); // Initialize and dock pan/zoom control on the panel. m_panZoomPanel = new PanZoomPanel(); m_panZoomPanel.Dock = DockStyle.Fill; panel1.Controls.Add(m_panZoomPanel); m_panZoomPanel.InvalidateImage(diagramClientView); Cursor.Hide(); }
internal ThumbnailViewForm(Control baseControl, DiagramClientView diagramClientView) { if (baseControl == null) throw new ArgumentNullException("baseControl"); if (diagramClientView == null) throw new ArgumentNullException("diagramClientView"); // Initialize the form. this.TopMost = true; this.ShowInTaskbar = false; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; // Position form so that its center lines up with the center of thumbnail control // at designer's bottom-right corner. Point location = baseControl.PointToScreen(new Point(baseControl.Width / 2, baseControl.Height / 2)); location.Offset(-ViewSize / 2, -ViewSize / 2); this.Bounds = new Rectangle(location.X, location.Y, ViewSize, ViewSize); // Make sure thumbnail form fits the screen and doesn't go below or off the right // edge of the screen. Rectangle screenBounds = Screen.FromControl(diagramClientView).WorkingArea; if (this.Right > screenBounds.Right) this.Left = screenBounds.Right - this.Width; if (this.Bottom > screenBounds.Bottom) this.Top = screenBounds.Bottom - this.Height; // Initialize a panel to host pan/zoom control. Panel panel1 = new Panel(); panel1.Dock = DockStyle.Fill; panel1.BorderStyle = BorderStyle.FixedSingle; this.Controls.Add(panel1); // Initialize and dock pan/zoom control on the panel. m_panZoomPanel = new PanZoomPanel(); m_panZoomPanel.Dock = DockStyle.Fill; panel1.Controls.Add(m_panZoomPanel); m_panZoomPanel.InvalidateImage(diagramClientView); Cursor.Hide(); }