protected override void OnRender (DrawingContext dc) { if (!IsVisible) return; dc.DrawLine (new Pen (Colors.Red, 2), new Point (X + 5, Y), new Point (X + 5, Y + 10)); dc.DrawLine (new Pen (Colors.Red, 2), new Point (X, Y + 5), new Point (X + 10, Y + 5)); }
private void DrawVLine (DrawingContext dc) { var activeArea = GetArea (Region.Selection.SelectedToken, Region); if (activeArea == null) return; var width = Region.Selection.Type == SelectionType.Left ? -2 : activeArea.Width + 2; if (Region.Selection.SelectedToken is TextToken) { var textToken = Region.Selection.SelectedToken as TextToken; if (!string.IsNullOrEmpty (textToken.Text) && Region.Selection.Position != 0) { var ft = new FormattedText (textToken.Text.Substring (0, Region.Selection.Position), textToken.FontFamily, textToken.FontSize, Colors.Black); width = ft.Width + 2; } else width = 0; } var startPoint = activeArea.PointToScreen (new Point (width, -2)); startPoint = Region.PointFromScreen (startPoint); var endPoint = activeArea.PointToScreen (new Point (width, activeArea.Height + 2)); endPoint = Region.PointFromScreen (endPoint); dc.DrawLine (new Pen (Colors.Red, 1.5), startPoint, endPoint); }
protected override void OnRender (DrawingContext dc) { var anialias = dc.Antialias; dc.Antialias = SnapsToDevicePixels ? Antialias.None : anialias; dc.DrawLine (new Pen (Stroke, StrokeThickness), new Point (StrokeThickness / 2, StrokeThickness / 2), new Point (Width - StrokeThickness / 2, Height - StrokeThickness / 2)); dc.Antialias = anialias; }
private void DrawHLine (DrawingContext dc) { var activeArea = GetArea (Region.Selection.SelectedToken, Region); if (activeArea == null) return; var startPoint = activeArea.PointToScreen (new Point (-1, activeArea.Height + 2)); startPoint = Region.PointFromScreen (startPoint); var endPoint = activeArea.PointToScreen (new Point (activeArea.Width + 2, activeArea.Height + 2)); endPoint = Region.PointFromScreen (endPoint); dc.DrawLine (new Pen (Colors.Red, 1.5), startPoint, endPoint); }