Notifications
Clear all
[Closed] pixel width of text in UI
Feb 10, 2011 10:43 pm
Hi all,
Im coding a UI which is completely generated procedurally via a text file. The on issue im coming up with is trying to get the buttons to line up as they vary thir width with what text is on them. I was looking at something like this:
(dotNetClass "System.Drawing.Graphics").measurestring "Hello" (dotNetObject "System.Drawing.Font" "Times New Roman" 12)
But was getting
– Runtime error: dotNet runtime exception: Non-static method requires a target.
any ideas?
2 Replies
1 Reply
use TextRenderer.MeasureText
(dotNetClass "TextRenderer").MeasureText "Hello" (dotNetObject "System.Drawing.Font" "Times New Roman" 12)
Feb 10, 2011 10:43 pm
Awesome! Thanks Denis! Somehow I know you would answer that one for me