@@ -102,6 +102,30 @@ protected PathAnnotation()
102102 /// <value>The text padding.</value>
103103 public double TextPadding { get ; set ; }
104104
105+ /// <summary>
106+ /// Gets or sets the padding of the border rectangle.
107+ /// </summary>
108+ /// <value>The border padding.</value>
109+ public OxyThickness BorderPadding { get ; set ; }
110+
111+ /// <summary>
112+ /// Gets or sets the fill color of the border rectangle.
113+ /// </summary>
114+ /// <value>The border background color.</value>
115+ public OxyColor BorderBackground { get ; set ; }
116+
117+ /// <summary>
118+ /// Gets or sets the stroke color of the border rectangle.
119+ /// </summary>
120+ /// <value>The border stroke color.</value>
121+ public OxyColor BorderStroke { get ; set ; }
122+
123+ /// <summary>
124+ /// Gets or sets the stroke thickness of the border rectangle.
125+ /// </summary>
126+ /// <value>The border stroke thickness.</value>
127+ public double BorderStrokeThickness { get ; set ; }
128+
105129 /// <summary>
106130 /// Gets or sets the text orientation.
107131 /// </summary>
@@ -254,6 +278,20 @@ public override void Render(IRenderContext rc)
254278 angle = this . TextRotation ;
255279 }
256280
281+ var textSize = rc . MeasureText ( this . Text , this . ActualFont , this . ActualFontSize , this . ActualFontWeight ) ;
282+
283+ var textBounds = TextAnnotation . GetTextBounds ( position , textSize , this . BorderPadding , angle , ha , va ) ;
284+
285+ if ( ( angle % 90 ) . Equals ( 0 ) )
286+ {
287+ var actualRect = new OxyRect ( textBounds [ 0 ] , textBounds [ 2 ] ) ;
288+ rc . DrawRectangle ( actualRect , this . BorderBackground , this . BorderStroke , this . BorderStrokeThickness , this . EdgeRenderingMode ) ;
289+ }
290+ else
291+ {
292+ rc . DrawPolygon ( textBounds , this . BorderBackground , this . BorderStroke , this . BorderStrokeThickness , this . EdgeRenderingMode ) ;
293+ }
294+
257295 rc . DrawText (
258296 textPosition ,
259297 this . Text ,
0 commit comments