Hi Ben,
I’m trying to mimic AutoCAD’s text alignments in ThinkGeo.
From an AutoCAD drawing, I extract information for each text string, including the font, height, rotation, and text alignment (justification).
This is the source from AutoCAD. The red crosses indicate the insertion points. The justification type is noted next to each text string.
I created a RotatedPointStyle
class that inherits from PointStyle
.
In this class, I override the DrawCore
method to calculate screen coordinates, determine the text height based on the font and height, and use canvas.DrawText
to render the text.
Case "left"
canvas.DrawText(text, font, New GeoSolidBrush(_Color), New GeoPen(), textPathInScreen, DrawingLevel.LabelLevel, 0, 0, DrawingTextAlignment.Left, 0)
Case "center"
canvas.DrawText(text, font, New GeoSolidBrush(_Color), New GeoPen(), textPathInScreen, DrawingLevel.LabelLevel, 0, 0, DrawingTextAlignment.Center, 0)
Case "right"
canvas.DrawText(text, font, New GeoSolidBrush(_Color), New GeoPen(), textPathInScreen, DrawingLevel.LabelLevel, 0, 0, DrawingTextAlignment.Right, 0)
However, as shown in the image below, all texts—whether horizontal or rotated—are being drawn as centered.
Any help or suggestions to fix this issue would be greatly appreciated.
Regards,
Guido van den Boom