After fiddling around with Stringshape and similar classes, I couldnt figure out how to determine the length (or better the bounding rect) of a stringshape before drawing it. Do you have any advice on how to do this?
You could create a temporay 1x1 picture to calculate the width and height of the string:
Dim p as new Picture(1, 1, 32) p.Graphics.TextFont = strShape.TextFont p.Graphics.TextSize = strShape.TextSize p.Graphics.TextUnit = strShape.TextUnit width = p.Graphics.StringWidth(strShape.Text) height = p.Graphics.StringHeight(strShape.Text)
The position of the bounding rect could be tricky, cause it will depend on the settings of StringShape.HorizontalAlignment and StringShape.VerticalAlignment.
Usually I also do the following to keep things simple when working with StringShapes:
strShape.HorizontalAlignment = StringShape.Alignment.Left strShape.VerticalAlignment = StringShape.Alignment.Top
Oh great! Thanks! I thought the picture would simply clip the stringshape.