On Feb 21, 2006, at 10:02 PM, [EMAIL PROTECTED] wrote:

I want to mimic the behaviour of the msgbox which automatically expands its height depending on the amount of text. Is there a parameter for the height of a statictext that takes into account the actual text in it (so "abc" is
different than "It was the best of times, it was the worst of
times.....................They lived happily ever after. The End."?

What is wrong with using the MsgBox, or even better yet the MessageDialog class. Unless you want to add your own controls (such as a PopupMenu, ProgressBar, etc...) these classes work fine and include a fair amount of customization.

But to answer your question...

Use a Graphics object, either the Window.Graphics, a Picture or a Canvas and set the TextSize, TextFont, Bold and Italic properties to match your StaticField. Then use Graphics.StringHeight(myString, myStaticText.Width) to find out the height required to display all of the text. Then set your StaticText field height to this value and adjust the height of the Window accordingly.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to