internal ThumbnailViewForm(Control baseControl, DiagramClientView diagramClientView) { if (baseControl == null) { throw new ArgumentNullException("baseControl"); } if (diagramClientView == null) { throw new ArgumentNullException("diagramClientView"); } // Initialize the form. TopMost = true; ShowInTaskbar = false; FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.Manual; // Position form so that its center lines up with the center of thumbnail control // at designer's bottom-right corner. var location = baseControl.PointToScreen(new Point(baseControl.Width / 2, baseControl.Height / 2)); location.Offset(-ViewSize / 2, -ViewSize / 2); 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. var screenBounds = Screen.FromControl(diagramClientView).WorkingArea; if (Right > screenBounds.Right) { Left = screenBounds.Right - Width; } if (Bottom > screenBounds.Bottom) { Top = screenBounds.Bottom - Height; } // Initialize a panel to host pan/zoom control. var panel1 = new Panel(); panel1.Dock = DockStyle.Fill; panel1.BorderStyle = BorderStyle.FixedSingle; Controls.Add(panel1); // Initialize and dock pan/zoom control on the panel. _panZoomPanel = new PanZoomPanel(); _panZoomPanel.Dock = DockStyle.Fill; panel1.Controls.Add(_panZoomPanel); _panZoomPanel.InvalidateImage(diagramClientView); Cursor.Hide(); }