Closed boa2145 closed 1 year ago
@boa2145
You can't. But you can quite the DrawText method, and start using the Controls.AddLabel
method to draw the text in a lable and have full control of it. You can change the font properties of the label, then call the FitContentSize
to force the label to resize its width and height to fit its text, so you can use its Width and Height properties to get the text size.
Note that sVB allow you to draw all controls (except menus) on the Graphics Window.
Try this:
Lbl = Controls.AddLabel("Hello sVB", 100, 100)
Lbl.FontSize = 20
Lbl.FitContentSize()
GraphicsWindow.ShowMessage(
Text.Format(
"Width = [1], Height = [2]",
{Lbl.Width, Lbl.Height}
),
"Text size"
)
Note also that sVB controls has more animation methods than the SB shapes, so, you can do a lot of amazing things with the text, like:
Lbl.AnimateAngle(50, 1000)
Hi Mohammad,
I sometimes need the length and height of a text in "Graphics mode" when using "GraphicsWindow" with "DrawText()" or "DrawBoundText()". How can I calculate the length and height of a text depending on the font name and font size?
Regards ... Gregor