protected override void DrawText(string text, UIntPtr font, ref web_color color, ref position pos) { text = text.Replace(' ', (char)160); var fontInfo = GetFont(font); var formattedText = fontInfo.GetFormattedText(text); formattedText.SetForegroundBrush(color.GetBrush()); DrawingContext.DrawText(formattedText, new Point(pos.x, pos.y)); }
public static Pen GetPen(this web_color color, float thickness) { var key = color.red.ToString() + color.green.ToString() + color.blue.ToString() + thickness; if (!_pens.TryGetValue(key, out var result)) { var brush = color.GetBrush(); result = new Pen(brush, thickness); _pens.Add(key, result); } return(result); }
public static Pen GetPen(this web_color color, double thickness) { string key = color.red.ToString() + color.green.ToString() + color.blue.ToString() + thickness; Pen result = null; if (!_pens.TryGetValue(key, out result)) { Brush brush = color.GetBrush(); result = new Pen(brush, thickness); _pens.Add(key, result); } return(result); }
protected override void DrawBackground(UIntPtr hdc, string image, background_repeat repeat, ref web_color color, ref position pos, ref border_radiuses br, ref position borderBox, bool isRoot) { if (pos.width > 0 && pos.height > 0) { if (!String.IsNullOrEmpty(image)) { var bitmap = LoadImage(image); if (bitmap != null) { DrawImage(bitmap, new Rect(pos.x, pos.y, pos.width, pos.height)); } } else { Rect rect = new Rect(pos.x, pos.y, pos.width, pos.height); var geometry = new PathGeometry(); PathSegmentCollection path = new PathSegmentCollection(); path.Add(new LineSegment(new Point(rect.Right - br.top_right_x, rect.Top), false)); path.Add(new QuadraticBezierSegment(new Point(rect.Right, rect.Top), new Point(rect.Right, rect.Top + br.top_right_y), false)); path.Add(new LineSegment(new Point(rect.Right, rect.Bottom - br.bottom_right_y), false)); path.Add(new QuadraticBezierSegment(new Point(rect.Right, rect.Bottom), new Point(rect.Right - br.bottom_right_x, rect.Bottom), false)); path.Add(new LineSegment(new Point(rect.Left + br.bottom_left_x, rect.Bottom), false)); path.Add(new QuadraticBezierSegment(new Point(rect.Left, rect.Bottom), new Point(rect.Left, rect.Bottom - br.bottom_left_y), false)); path.Add(new LineSegment(new Point(rect.Left, rect.Top + br.top_left_y), false)); path.Add(new QuadraticBezierSegment(new Point(rect.Left, rect.Top), new Point(rect.Left + br.top_left_x, rect.Top), false)); geometry.Figures.Add(new PathFigure(new Point(rect.Left + br.top_left_x, rect.Top), path, true)); DrawingContext.DrawGeometry(color.GetBrush(), null, geometry); } } }
protected override void DrawListMarker(string image, string baseURL, list_style_type marker_type, ref web_color color, ref position pos) { DrawRect(pos.x, pos.y, pos.width, pos.height, color.GetBrush()); }