/// <summary> /// Gets the border image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteState state) { if (Apply) { PaletteImageStyle ret = _primary.GetBorderImageStyle(Override ? OverrideState : state); if (ret == PaletteImageStyle.Inherit) { ret = _backup.GetBorderImageStyle(state); } return(ret); } else { return(_backup.GetBorderImageStyle(state)); } }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public PaletteImageStyle GetBorderImageStyle(PaletteState state) { if (ImageStyle != PaletteImageStyle.Inherit) { return(ImageStyle); } else { return(_inherit.GetBorderImageStyle(state)); } }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteBorderStyle style, PaletteState state) { IPaletteBorder inherit = GetInherit(state); if (inherit != null) { return(inherit.GetBorderImageStyle(state)); } else { return(Target.GetBorderImageStyle(style, state)); } }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public PaletteImageStyle GetBorderImageStyle(PaletteState state) { return(_inherit.GetBorderImageStyle(state)); }
/// <summary> /// Gets the background image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public PaletteImageStyle GetBackImageStyle(PaletteState state) { return(_parent.GetBorderImageStyle(state)); }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteBorderStyle style, PaletteState state) { IPaletteBorder inherit = GetInherit(state); return(inherit?.GetBorderImageStyle(state) ?? Target.GetBorderImageStyle(style, state)); }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteState state) => _inherit.GetBorderImageStyle(state);
/// <summary> /// Draw border on the inside edge of the specified rectangle. /// </summary> /// <param name="context">Rendering context.</param> /// <param name="rect">Target rectangle.</param> /// <param name="palette">Palette used for drawing.</param> /// <param name="orientation">Visual orientation of the border.</param> /// <param name="state">State associated with rendering.</param> public override void DrawBorder(RenderContext context, Rectangle rect, IPaletteBorder palette, VisualOrientation orientation, PaletteState state) { Debug.Assert(context != null); Debug.Assert(palette != null); // Validate parameter references if (context == null) throw new ArgumentNullException("context"); if (palette == null) throw new ArgumentNullException("palette"); Debug.Assert(context.Control != null); Debug.Assert(!context.Control.IsDisposed); PaletteDrawBorders borders = palette.GetBorderDrawBorders(state); // Is there anything to actually draw? if ((rect.Width > 0) && (rect.Height > 0) && CommonHelper.HasABorder(borders)) { // Only use anti aliasing if the border is rounded SmoothingMode smoothMode = (palette.GetBorderRounding(state) > 0 ? SmoothingMode.AntiAlias : SmoothingMode.Default); // We want to draw using anti aliasing for a nice smooth effect using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state))) { // Cache commonly used values int borderWidth = palette.GetBorderWidth(state); // Get the orientation correct borders value borders = CommonHelper.OrientateDrawBorders(borders, orientation); // Is there any border to actually draw? if (borderWidth > 0) { using (Clipping clip = new Clipping(context.Graphics, rect)) { // We always create the first border path variant GraphicsPath borderPath0 = CreateBorderBackPath(true, true, rect, borders, borderWidth, palette.GetBorderRounding(state), (smoothMode == SmoothingMode.AntiAlias), 0); GraphicsPath borderPath1 = null; // We only need the second border path if the two borders used are opposite each other if ((borders == PaletteDrawBorders.TopBottom) || (borders == PaletteDrawBorders.LeftRight)) { borderPath1 = CreateBorderBackPath(true, true, rect, borders, borderWidth, palette.GetBorderRounding(state), (smoothMode == SmoothingMode.AntiAlias), 1); } // Get the rectangle to use when dealing with gradients Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect); // Use standard helper routine to create appropriate color brush PaletteColorStyle colorStyle = palette.GetBorderColorStyle(state); using (Pen borderPen = new Pen(CreateColorBrush(gradientRect, palette.GetBorderColor1(state), palette.GetBorderColor2(state), colorStyle, palette.GetBorderColorAngle(state), orientation), borderWidth)) { if (colorStyle == PaletteColorStyle.Dashed) borderPen.DashPattern = new float[] { 2, 2 }; context.Graphics.DrawPath(borderPen, borderPath0); // Optionally also draw the second path if (borderPath1 != null) context.Graphics.DrawPath(borderPen, borderPath1); } Image borderImage = palette.GetBorderImage(state); PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state); // Do we need to draw the image? if (ShouldDrawImage(borderImage)) { // Get the rectangle to use when dealing with gradients Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect); // Use standard helper routine to create appropriate image brush using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth)) { context.Graphics.DrawPath(borderPen, borderPath0); // Optionally also draw the second path if (borderPath1 != null) context.Graphics.DrawPath(borderPen, borderPath1); } } // Remember to dispose of resources borderPath0.Dispose(); if (borderPath1 != null) borderPath1.Dispose(); } } } } }
/// <summary> /// Draw border on the inside edge of the specified rectangle. /// </summary> /// <param name="context">Rendering context.</param> /// <param name="rect">Target rectangle.</param> /// <param name="palette">Palette used for drawing.</param> /// <param name="orientation">Visual orientation of the border.</param> /// <param name="state">State associated with rendering.</param> /// <param name="tabBorderStyle">Style of tab border.</param> public override void DrawTabBorder(RenderContext context, Rectangle rect, IPaletteBorder palette, VisualOrientation orientation, PaletteState state, TabBorderStyle tabBorderStyle) { Debug.Assert(context != null); Debug.Assert(palette != null); // Validate parameter references if (context == null) throw new ArgumentNullException("context"); if (palette == null) throw new ArgumentNullException("palette"); Debug.Assert(context.Control != null); Debug.Assert(!context.Control.IsDisposed); // Is there anything to actually draw? if ((rect.Width > 0) && (rect.Height > 0)) { // Decide if we need to use anti aliasing for a smoother looking visual using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state))) { // Cache commonly used values int borderWidth = palette.GetBorderWidth(state); // Is there any border to actually draw? if (borderWidth > 0) { // Create the path that represents the entire tab border using (GraphicsPath borderPath = CreateTabBorderBackPath(context.Control.RightToLeft, state, true, rect, borderWidth, tabBorderStyle, orientation, (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias))) { // Get the rectangle to use when dealing with gradients Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect); // Use standard helper routine to create appropriate color brush using(Brush borderBrush = CreateColorBrush(gradientRect, palette.GetBorderColor1(state), palette.GetBorderColor2(state), palette.GetBorderColorStyle(state), palette.GetBorderColorAngle(state), orientation)) { using (Pen borderPen = new Pen(borderBrush, borderWidth)) context.Graphics.DrawPath(borderPen, borderPath); } Image borderImage = palette.GetBorderImage(state); // Do we need to draw the image? if (ShouldDrawImage(borderImage)) { // Get the rectangle to use when dealing with gradients Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect); // Get the image style to use for the image brush PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state); // Use standard helper routine to create appropriate image brush using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth)) { context.Graphics.DrawPath(borderPen, borderPath); } } } } } } }
/// <summary> /// Gets the background image style. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public PaletteImageStyle GetBackImageStyle(PaletteState state) => _parent.GetBorderImageStyle(state);