public override void DrawRectangle(RPen pen, double x, double y, double width, double height) { var adj = pen.Width; if (Math.Abs(adj % 2 - 1) < .1) { x += .5; y += .5; } _g.DrawRectange(((PenAdapter)pen).CreatePen(), new Rect(x, y, width, height)); }
public override void Render(IDrawingContext context) { Brush background = this.Background; Brush borderBrush = this.BorderBrush; double borderThickness = this.BorderThickness; Rect rect = new Rect(this.ActualSize).Deflate(BorderThickness / 2); if (background != null) { context.FillRectange(background, rect); } if (borderBrush != null && borderThickness > 0) { context.DrawRectange(new Pen(borderBrush, borderThickness), rect); } }
public override void Render(IDrawingContext context) { var background = Brushes.Silver; var borderBrush = Brushes.AliceBlue; var borderThickness = 3; var cornerRadius = 2; var rect = new Rect(Bounds.Size).Deflate(new Thickness(borderThickness)); if (background != null) { context.FillRectange(background, rect, cornerRadius); } if (borderBrush != null && borderThickness > 0) { context.DrawRectange(new Pen(borderBrush, borderThickness), rect, cornerRadius); } }
public override void Render(IDrawingContext context) { Brush background = this.Background; Brush borderBrush = this.BorderBrush; double borderThickness = this.BorderThickness; float cornerRadius = this.CornerRadius; Rect rect = new Rect(this.Bounds.Size).Deflate(this.BorderThickness); if (background != null) { context.FillRectange(background, rect, cornerRadius); } if (borderBrush != null && borderThickness > 0) { context.DrawRectange(new Pen(borderBrush, borderThickness), rect, cornerRadius); } }
/// <summary> /// Renders the control. /// </summary> /// <param name="context">The drawing context.</param> public override void Render(IDrawingContext context) { var background = Background; var borderBrush = BorderBrush; var borderThickness = BorderThickness; var cornerRadius = CornerRadius; var rect = new Rect(Bounds.Size).Deflate(BorderThickness); if (background != null) { context.FillRectange(background, rect, cornerRadius); } if (borderBrush != null && borderThickness > 0) { context.DrawRectange(new Pen(borderBrush, borderThickness), rect, cornerRadius); } }