none
adding text to graphics RRS feed

  • Question

  • I have created some 'engineering' graphics in code (geometryDrawing).  To add text to it such as dimensions, labels etc. there seems to be no way of doing this except to convert the text to a geometry, as follows:

     

    Dim objText As FormattedText = New FormattedText(Text, ,,,New Typeface(New System.Windows.Media.FontFamily("Arial"),, FontStyles.Normal, FontWeights.Light, FontStretches.Normal), fontsize, Brushes.Black)

     

    Dim objTextGeometry As Geometry = objText.BuildGeometry(New Point(x1, y1))

    However, when I do this, the font and font size on my graphics has no relation to the what I specify (well, it does really, but it is bold, at least 24, even though I specify 10).  I also notice that when my graphics is zoomed out, the text grows with it as well.  This is not the desired behaviour. If I reduce the font size below 10, it is blurred and illegible!

    Surely, there must be a way to add normal text to a graphics rendered in an image box?

    Help please!

    Friday, December 17, 2010 11:00 AM

Answers