|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Auto Expanding TextBox/ControlsHi there,
I've googled this problem, and not found a suitable solution yet. I was wondering if anyone has made any progress? Basically, I want to make a textbox automagically adjust it's height to show all the text it contains. So, if I add text then it grows, and it shrinks if I remove text. This is similar to the CanGrow property in MS Access controls. I'm willing to purchase a control if anyone knows of any, I'd just like to get this cracked without spending *too* much time "fiddling" about! Any help much appreciated Tobin I found it! It took *lots* of searching, but it's quite straight forward...
public static int GetLineCount( TextBoxBase textbox ) { const int EM_GETLINECOUNT = 186; return SendMessage( textbox.Handle, EM_GETLINECOUNT, 0, 0 ); } Handles word wrap too! Tobin Show quoteHide quote "Tobin Harris" <tobin@tobin_do_not_spam_harris.com> wrote in message news:41ad07e8$0$1059$db0fefd9@news.zen.co.uk... > Hi there, > > I've googled this problem, and not found a suitable solution yet. I was > wondering if anyone has made any progress? > > Basically, I want to make a textbox automagically adjust it's height to > show all the text it contains. So, if I add text then it grows, and it > shrinks if I remove text. This is similar to the CanGrow property in MS > Access controls. > > I'm willing to purchase a control if anyone knows of any, I'd just like to > get this cracked without spending *too* much time "fiddling" about! > > Any help much appreciated > > Tobin > >
Other interesting topics
Transparent control
find process by processname How to simply load a freeekin bitmap from a resource? Deployed simple C#.NET single form application to Windows server 2003 and the form will not display, DateTime Bound to TextBox Creating VS Studio like control creating VS Studio like controls Post-Mortem Debugging How to print AxWebBrowser control? prevent Multi line select on DataGrid? |
|||||||||||||||||||||||