|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need to resize label height automatically.background of the box depending on the information it is representing. That aside, I need to be able to auto-size the box depending on the amount of data within it. Sometimes the text in the label will be single-line, but a little long where it needs to wrap. Sometimes the text in the label has been forced to spread over three lines. Sometimes the label has only one lshort text string. The problem is that the Autosize property only affects the width of the label, and I need it to resize to reasonable dimensions. I do not want a very long tooltip spanning the entire screen when it could wrap round to three shorter lines in a box. I do not want the text in the box to become truncated because the box isn't big enough. So please, can anyone come up with a sensible and effective means of scaling a label (or alternative control) so that the data within is displayed in a box representing a 5:4 ratio or thereabouts? Thanks in advance for any feedback. Newsgroup replies only please. "ngreplies" <ngrepl***@voidtdrd.freeserve.co.uk> wrote in message There's probably a cleverer way these days, but when I've done thingsnews:dstmof$j64$1@news6.svr.pol.co.uk... >I am using a label as a tooltip box because I need to be able to change the >background of the box depending on the information it is representing. > The problem is that the Autosize property only affects the width of the > label, and I need it to resize to reasonable dimensions. > So please, can anyone come up with a sensible and effective means of > scaling a label (or alternative control) so that the data within is > displayed in a box representing a 5:4 ratio or thereabouts? like this I've let the Label size itself initially, then dragged it back width-wise, kicking and screaming, until it gets to a ratio I'm happy with - IIRC, as you "squash" it horizontally, it will grow vertically by itself. It's probably best to do this on a non-visible Label, then copy the Text and Size properties over to your tooltip Label (which no longer needs to be AutoSize'd), something like With lblAutoSizer .Text = ... Do While ( .Width / .Height ) > ( 5 / 4 ) .Width = CInt( .Width * 0.9 ) Loop lblToolTip.Text = .Text lblToolTip.Size = .Size End With HTH, Phill W. |
|||||||||||||||||||||||