/// <summary>Draws an arrow button.</summary> /// <param name="graphics">The <see cref="Graphics" /> used to paint.</param> /// <param name="arrowUp">true for an up arrow, false otherwise.</param> /// <param name="border">The border.</param> /// <param name="color">The color.</param> /// <param name="enabled">The enabled.</param> /// <param name="orientation">The <see cref="Orientation" />.</param> /// <param name="rectangle">The rectangle in which to paint.</param> /// <param name="state">The <see cref="MouseStates" /> of the arrow button.</param> public static void DrawArrowButton(Graphics graphics, bool arrowUp, Border border, ControlColorState color, bool enabled, Orientation orientation, Rectangle rectangle, MouseStates state) { if (graphics == null) { throw new ArgumentNullException("graphics"); } if (rectangle.IsEmpty || graphics.IsVisibleClipEmpty || !graphics.VisibleClipBounds.IntersectsWith(rectangle)) { return; } Color _thumbBackColor = ControlColorState.BackColorState(color, enabled, state); VisualBackgroundRenderer.DrawBackground(graphics, _thumbBackColor, state, rectangle, border); GraphicsPath _buttonGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(rectangle, border); VisualBorderRenderer.DrawBorderStyle(graphics, border, _buttonGraphicsPath, state); Image _arrowImage = RetrieveButtonArrowImage(enabled); _arrowImage = RotateImageByOrientation(_arrowImage, orientation, arrowUp); graphics.DrawImage(_arrowImage, rectangle); }
/// <summary>Draws a button control.</summary> /// <param name="graphics">The graphics to draw on.</param> /// <param name="rectangle">The coordinates of the rectangle to draw.</param> /// <param name="backColor">The BackColor of the button.</param> /// <param name="backgroundImage">The background image for the button.</param> /// <param name="border">The border.</param> /// <param name="mouseState">The mouse State.</param> /// <param name="text">The string to draw.</param> /// <param name="font">The font to use in the string.</param> /// <param name="foreColor">The color of the string.</param> /// <param name="image">The image to draw.</param> /// <param name="imageSize">The image Size.</param> /// <param name="textImageRelation">The text image relation.</param> public static void DrawButton(Graphics graphics, Rectangle rectangle, Color backColor, Image backgroundImage, Border border, MouseStates mouseState, string text, Font font, Color foreColor, Image image, Size imageSize, TextImageRelation textImageRelation) { GraphicsPath _controlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(rectangle, border); VisualBackgroundRenderer.DrawBackground(graphics, backColor, backgroundImage, mouseState, rectangle, border); DrawContent(graphics, rectangle, text, font, foreColor, image, imageSize, textImageRelation); VisualBorderRenderer.DrawBorderStyle(graphics, border, _controlGraphicsPath, mouseState); }
/// <summary>Draws a check box control in the specified state and location.</summary> /// <param name="graphics">The graphics to draw on.</param> /// <param name="border">The border type.</param> /// <param name="checkStyle">The check mark type.</param> /// <param name="rectangle">The rectangle that represents the dimensions of the check box.</param> /// <param name="checkState">The check State.</param> /// <param name="enabled">The state to draw the check mark in.</param> /// <param name="color">The background color.</param> /// <param name="backgroundImage">The background Image.</param> /// <param name="mouseStates">The mouse States.</param> public static void DrawCheckBox(Graphics graphics, Border border, CheckStyle checkStyle, Rectangle rectangle, bool checkState, bool enabled, Color color, Image backgroundImage, MouseStates mouseStates) { GraphicsPath _boxGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(rectangle, border); graphics.SetClip(_boxGraphicsPath); VisualBackgroundRenderer.DrawBackground(graphics, color, backgroundImage, mouseStates, rectangle, border); if (checkState) { DrawCheckMark(graphics, checkStyle, rectangle, enabled); } VisualBorderRenderer.DrawBorderStyle(graphics, border, _boxGraphicsPath, mouseStates); graphics.ResetClip(); }