/// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawCCWRotateButton(NuGenPaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams); switch (imagePaintParams.State) { case NuGenControlState.Hot: case NuGenControlState.Pressed: { imagePaintParams.Image = res.RotateCCW_Hot; break; } default: { imagePaintParams.Image = res.RotateCCW_Normal; break; } } this.DrawImage(imagePaintParams); }
/// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawImage(NuGenImagePaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } paintParams.Graphics.DrawImage(paintParams.Image, paintParams.Bounds); }
/// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawImage(NuGenImagePaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } paintParams.Graphics.DrawImage(paintParams.Image, paintParams.Bounds); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { NuGenPaintParams paintParams = new NuGenPaintParams(e.Graphics); paintParams.Bounds = this.ClientRectangle; paintParams.State = this.ButtonStateTracker.GetControlState(); switch (paintParams.State) { case NuGenControlState.Pressed: case NuGenControlState.Hot: { _cwRotateButton.Visible = _ccwRotateButton.Visible = true; break; } default: { _cwRotateButton.Visible = _ccwRotateButton.Visible = false; break; } } this.Renderer.DrawBackground(paintParams); this.Renderer.DrawBorder(paintParams); NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(paintParams); using (Font font = this.Renderer.GetFont(textPaintParams.Bounds)) { textPaintParams.Bounds = this.LayoutManager.GetTextBounds(textPaintParams.Bounds, font.Size); textPaintParams.Font = font; textPaintParams.ForeColor = this.Renderer.GetForeColor(textPaintParams.State); textPaintParams.Text = this.Text; textPaintParams.TextAlign = this.TextAlign; this.Renderer.DrawText(textPaintParams); } Image image = this.Image; if (image != null) { NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams); imagePaintParams.Bounds = this.LayoutManager.GetImageBounds(imagePaintParams.Bounds, image.Size); imagePaintParams.Image = image; this.Renderer.DrawImage(imagePaintParams); this.Renderer.DrawBorder(imagePaintParams); } base.OnPaint(e); }
/* * DrawImage */ /// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawImage(NuGenImagePaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } Graphics g = paintParams.Graphics; Rectangle bounds = paintParams.Bounds; NuGenControlState state = paintParams.State; g.DrawImage(paintParams.Image, bounds); }
/* * DrawImage */ /// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawImage(NuGenImagePaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } Graphics g = paintParams.Graphics; Rectangle bounds = paintParams.Bounds; NuGenControlState state = paintParams.State; g.DrawImage(paintParams.Image, bounds); }
/// <summary> /// </summary> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> public void DrawSmallButtonBody(NuGenImagePaintParams paintParams) { if (paintParams == null) { throw new ArgumentNullException("paintParams"); } Graphics g = paintParams.Graphics; Rectangle bounds = paintParams.Bounds; NuGenControlState state = paintParams.State; Image image = paintParams.Image; if (image != null) { this.DrawImage(g, NuGenSmoothNavigationBarRenderer.GetSmallImageBounds(bounds), state, image); } }
private void DrawButton(Graphics g, HeaderButtonState state, HeaderButtons button, Rectangle bounds) { NuGenControlState currentState = NuGenControlState.Normal; if (_calendar.Enabled) { if (state == HeaderButtonState.Hot) { currentState = NuGenControlState.Hot; } else if (state == HeaderButtonState.Inactive) { currentState = NuGenControlState.Disabled; } else if (state == HeaderButtonState.Pushed) { currentState = NuGenControlState.Pressed; } } else { currentState = NuGenControlState.Disabled; } NuGenPaintParams paintParams = new NuGenPaintParams(g); paintParams.Bounds = bounds; paintParams.State = currentState; this.Renderer.DrawBackground(paintParams); this.Renderer.DrawBorder(paintParams); Image buttonImage; switch (button) { case HeaderButtons.NextYear: { buttonImage = this.Renderer.GetNextYearImage(); break; } case HeaderButtons.NextMonth: { buttonImage = this.Renderer.GetNextMonthImage(); break; } case HeaderButtons.PreviousYear: { buttonImage = this.Renderer.GetPreviousYearImage(); break; } default: { buttonImage = this.Renderer.GetPreviousMonthImage(); break; } } Debug.Assert(buttonImage != null, "buttonImage != null"); NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams); imagePaintParams.Image = buttonImage; Size imageSize = buttonImage.Size; imagePaintParams.Bounds = new Rectangle( bounds.Left + (bounds.Width - imageSize.Width) / 2 , bounds.Top + (bounds.Height - imageSize.Height) / 2 , imageSize.Width , imageSize.Height ); this.Renderer.DrawImage(imagePaintParams); }
private void DrawButton(Graphics g, HeaderButtonState state, HeaderButtons button, Rectangle bounds) { NuGenControlState currentState = NuGenControlState.Normal; if (_calendar.Enabled) { if (state == HeaderButtonState.Hot) currentState = NuGenControlState.Hot; else if (state == HeaderButtonState.Inactive) currentState = NuGenControlState.Disabled; else if (state == HeaderButtonState.Pushed) currentState = NuGenControlState.Pressed; } else currentState = NuGenControlState.Disabled; NuGenPaintParams paintParams = new NuGenPaintParams(g); paintParams.Bounds = bounds; paintParams.State = currentState; this.Renderer.DrawBackground(paintParams); this.Renderer.DrawBorder(paintParams); Image buttonImage; switch (button) { case HeaderButtons.NextYear: { buttonImage = this.Renderer.GetNextYearImage(); break; } case HeaderButtons.NextMonth: { buttonImage = this.Renderer.GetNextMonthImage(); break; } case HeaderButtons.PreviousYear: { buttonImage = this.Renderer.GetPreviousYearImage(); break; } default: { buttonImage = this.Renderer.GetPreviousMonthImage(); break; } } Debug.Assert(buttonImage != null, "buttonImage != null"); NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams); imagePaintParams.Image = buttonImage; Size imageSize = buttonImage.Size; imagePaintParams.Bounds = new Rectangle( bounds.Left + (bounds.Width - imageSize.Width) / 2 , bounds.Top + (bounds.Height - imageSize.Height) / 2 , imageSize.Width , imageSize.Height ); this.Renderer.DrawImage(imagePaintParams); }