/// <summary>Draws a snapped border with uniform or non-uniform thickness.</summary> internal static void DrawFrame(DrawingContext dc, Brush fill, Brush stroke, Thickness thickness, Rect rect) { var x = Math.Round(rect.X); var y = Math.Round(rect.Y); var w = Math.Round(rect.Width); var h = Math.Round(rect.Height); if (fill != null) { dc.DrawRectangle(fill, null, rect); } if (stroke != null && !thickness.IsZero()) { DrawVertical(dc, stroke.ToPen(thickness.Left), x - 0.5, y, y + h); DrawVertical(dc, stroke.ToPen(thickness.Right), x + w + 0.5, y, y + h); DrawHorizontal(dc, stroke.ToPen(thickness.Top), y - 0.5, x, x + w); DrawHorizontal(dc, stroke.ToPen(thickness.Bottom), y + h + 0.5, x, x + w); } }
public void AddThicknessOptional(Thickness th, string prefix, string suffix = null) { if (th.IsZero()) return; AddThickness(th, prefix, suffix); }