public override void OnRender(Media.DrawingContext dc) { if (_pts != null) { dc.DrawPolygon(Fill, Stroke, _pts); } }
public override void OnRender(Media.DrawingContext dc) { /// Make room for cases when strokes are thick. var x = this._renderWidth / 2 + this.Stroke.Thickness - 1; var y = this._renderHeight / 2 + this.Stroke.Thickness - 1; var w = this._renderWidth / 2 - (this.Stroke.Thickness - 1) * 2; var h = this._renderHeight / 2 - (this.Stroke.Thickness - 1) * 2; dc.DrawEllipse(this.Fill, this.Stroke, x, y, w, h); }
public override void OnRender(Media.DrawingContext dc) { /// Make room for cases when strokes are thick. int x = _renderWidth / 2 + Stroke.Thickness - 1; int y = _renderHeight / 2 + Stroke.Thickness - 1; int w = _renderWidth / 2 - (Stroke.Thickness - 1) * 2; int h = _renderHeight / 2 - (Stroke.Thickness - 1) * 2; dc.DrawEllipse(Fill, Stroke, x, y, w, h); }
public override void OnRender(Media.DrawingContext dc) { int width = this._renderWidth; int height = this._renderHeight; if (_direction == Direction.TopToBottom) { dc.DrawLine(Stroke, 0, 0, width - 1, height - 1); } else { dc.DrawLine(Stroke, 0, height - 1, width - 1, 0); } }
public override void OnRender(Media.DrawingContext dc) { int offset = Stroke != null ? Stroke.Thickness / 2 : 0; dc.DrawRectangle(Fill, Stroke, offset, offset, _renderWidth - 2 * offset, _renderHeight - 2 * offset); }
public override void OnRender(Media.DrawingContext dc) { if (_lineCache == null || _lineCache.Count == 0) { return; } int nLines = _lineCache.Count; int top = 0; int width, height; GetRenderSize(out width, out height); // Draw each line of Text // int lineNumber = _currentLine; while (lineNumber < nLines) { TextLine line = (TextLine)_lineCache[lineNumber]; if (top + line.Height > height) { break; } TextRun[] runs = line.Runs; int x; switch (_alignment) { case TextAlignment.Left: x = 0; break; case TextAlignment.Center: x = (width - line.Width) >> 1; // >> 1 is the same as div by 2 break; case TextAlignment.Right: x = width - line.Width; break; default: throw new NotSupportedException(); } for (int i = 0; i < runs.Length; i++) { TextRun run = runs[i]; int w, h; run.GetSize(out w, out h); int y = top + line.Baseline - run.Font.Ascent; dc.DrawText(run.Text, run.Font, run.ForeColor, x, y); x += w; } top += line.Height; lineNumber++; } }
public override void OnRender(Media.DrawingContext dc) { var offset = this.Stroke != null ? this.Stroke.Thickness / 2 : 0; dc.DrawRectangle(this.Fill, this.Stroke, offset, offset, this._renderWidth - 2 * offset, this._renderHeight - 2 * offset); }