/// <summary> /// Create and return visual node for the line. /// </summary> internal TextBoxLineDrawingVisual CreateVisual() { TextBoxLineDrawingVisual visual = new TextBoxLineDrawingVisual(); // Calculate shift in line offset to render trailing spaces or avoid clipping text. double delta = CalculateXOffsetShift(); DrawingContext ctx = visual.RenderOpen(); _line.Draw(ctx, new Point(delta, 0), ((_lineProperties.FlowDirection == FlowDirection.RightToLeft) ? InvertAxes.Horizontal : InvertAxes.None)); ctx.Close(); return(visual); }
/// <summary> /// Create and return visual node for the line. /// </summary> internal TextBoxLineDrawingVisual CreateVisual(Geometry selectionGeometry) { TextBoxLineDrawingVisual visual = new TextBoxLineDrawingVisual(); // Calculate shift in line offset to render trailing spaces or avoid clipping text. double delta = CalculateXOffsetShift(); DrawingContext ctx = visual.RenderOpen(); if (selectionGeometry != null) { var uiScope = _owner?.Host?.TextContainer?.TextSelection?.TextEditor?.UiScope; if (uiScope != null) { Brush selectionBrush = uiScope.GetValue(TextBoxBase.SelectionBrushProperty) as Brush; if (selectionBrush != null) { double selectionBrushOpacity = (double)uiScope.GetValue(TextBoxBase.SelectionOpacityProperty); ctx.PushOpacity(selectionBrushOpacity); // We use a Pen created from the brush used for the selection with a default thickness. // This fixes issues where the geometries for the independent selection do not overlap // and gaps can be seen to the background of the control between selection geometries. ctx.DrawGeometry(selectionBrush, new Pen() { Brush = selectionBrush }, selectionGeometry); ctx.Pop(); } } } _line.Draw(ctx, new Point(delta, 0), ((_lineProperties.FlowDirection == FlowDirection.RightToLeft) ? InvertAxes.Horizontal : InvertAxes.None)); ctx.Close(); return(visual); }
/// <summary> /// Create and return visual node for the line. /// </summary> internal TextBoxLineDrawingVisual CreateVisual() { TextBoxLineDrawingVisual visual = new TextBoxLineDrawingVisual(); // Calculate shift in line offset to render trailing spaces or avoid clipping text. double delta = CalculateXOffsetShift(); DrawingContext ctx = visual.RenderOpen(); _line.Draw(ctx, new Point(delta, 0), ((_lineProperties.FlowDirection == FlowDirection.RightToLeft) ? InvertAxes.Horizontal : InvertAxes.None)); ctx.Close(); return visual; }
// Token: 0x06004135 RID: 16693 RVA: 0x0012A278 File Offset: 0x00128478 internal TextBoxLineDrawingVisual CreateVisual(Geometry selectionGeometry) { TextBoxLineDrawingVisual textBoxLineDrawingVisual = new TextBoxLineDrawingVisual(); double x = this.CalculateXOffsetShift(); DrawingContext drawingContext = textBoxLineDrawingVisual.RenderOpen(); if (selectionGeometry != null) { TextBoxView owner = this._owner; FrameworkElement frameworkElement; if (owner == null) { frameworkElement = null; } else { ITextBoxViewHost host = owner.Host; if (host == null) { frameworkElement = null; } else { ITextContainer textContainer = host.TextContainer; if (textContainer == null) { frameworkElement = null; } else { ITextSelection textSelection = textContainer.TextSelection; if (textSelection == null) { frameworkElement = null; } else { TextEditor textEditor = textSelection.TextEditor; frameworkElement = ((textEditor != null) ? textEditor.UiScope : null); } } } } FrameworkElement frameworkElement2 = frameworkElement; if (frameworkElement2 != null) { Brush brush = frameworkElement2.GetValue(TextBoxBase.SelectionBrushProperty) as Brush; if (brush != null) { double opacity = (double)frameworkElement2.GetValue(TextBoxBase.SelectionOpacityProperty); drawingContext.PushOpacity(opacity); drawingContext.DrawGeometry(brush, new Pen { Brush = brush }, selectionGeometry); drawingContext.Pop(); } } } this._line.Draw(drawingContext, new Point(x, 0.0), (this._lineProperties.FlowDirection == FlowDirection.RightToLeft) ? InvertAxes.Horizontal : InvertAxes.None); drawingContext.Close(); return(textBoxLineDrawingVisual); }