/// <summary> /// Paint /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Renderer != null) { PreviewRenderer.ShowFormPreview(ClientRectangle, Renderer, e.Graphics); } }
/// <summary> /// On paint select current preview /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPaintSelectCurrentPreview(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; PreviewRenderer renderer = _selectCurrentRenderer; renderer.SelectedForm = _selectedForm; PreviewRenderer.ShowFormPreview(_selectCurrentPreview.ClientRectangle, renderer, graphics); }
/// <summary> /// On paint select next preview /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPaintSelectNextPreview(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; Matrix transformMatrix = new Matrix(); transformMatrix.Shear(0.0F, 0.50F); graphics.MultiplyTransform(transformMatrix); PreviewRenderer renderer = _selectNextRenderer; renderer.SelectedForm = NextForm; PreviewRenderer.ShowFormPreview(new Rectangle(0, 0, _previewSize.Width, _previewSize.Height), renderer, graphics); }
/// <summary> /// Show form preview /// </summary> /// <param name="bounds">preview bounds</param> /// <param name="renderer">renderer</param> /// <param name="graphics">graphics</param> public static void ShowFormPreview(Rectangle bounds, PreviewRenderer renderer, Graphics graphics) { using (GraphicsPath path = GraphicsUtility.CreateRoundRectPath(bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 5)) { renderer.DrawBackground(bounds, path, graphics); renderer.DrawBorder(bounds.Size, path, graphics); } Rectangle titleBounds = new Rectangle(bounds.Left + 10, bounds.Top + 10, bounds.Width - 21, 24); graphics.SetClip(titleBounds, CombineMode.Replace); renderer.DrawTitle(titleBounds, graphics); Rectangle previewBounds = new Rectangle(bounds.Left + 10, bounds.Top + 40, bounds.Width - 21, bounds.Height - 50); graphics.SetClip(previewBounds, CombineMode.Replace); renderer.DrawPreview(previewBounds, graphics); }
/// <summary> /// On paint select back preview /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPaintSelectBackPreview(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; int dh = ComputePreviewHeightOffset(_previewSize); graphics.TranslateTransform(0, dh); Matrix transformMatrix = new Matrix(); transformMatrix.Shear(0.0F, -0.50F); graphics.MultiplyTransform(transformMatrix); PreviewRenderer renderer = _selectBackRenderer; renderer.SelectedForm = PreviousForm; PreviewRenderer.ShowFormPreview(new Rectangle(0, 0, _previewSize.Width, _previewSize.Height), renderer, graphics); }
/// <summary> /// Show forms selector /// </summary> /// <param name="containerScreenBounds">screen bounds of the container</param> /// <param name="forms">forms to select</param> public void Show(PreviewRenderer renderer, Rectangle containerScreenBounds, DockableFormInfo[] forms) { Renderer = renderer; _forms = forms; if (_forms == null) { _forms = new DockableFormInfo[0]; } for (int index = 0; index < _forms.Length; index++) { if (_forms[index].IsSelected) { SelectedIndex = index; break; } } _screenBounds = containerScreenBounds; ShowSelector(); }
/// <summary> /// Default constructor /// </summary> public PreviewPane() { Renderer = new PreviewRenderer(); }