in reply to Win32:GUI Label resize
Windows native label controls do not automatically resize when the text changes, which means that unless Win32::GUI add that functionality -- which I doubt given its minimalist approach to things -- that you would need to do that yourself.
That would mean setting up a _Change() handler for the label control and handling the text change yourself. That would then involve using FontMetrics to calculate the size of the text given the current Font, and then calling Resize() on the label accordingly.
Probably your easiest bet would be to just Remove() the existing Label control and then AddLabel() with the new text.
An alternative would be to pre-size the Label (-Width -Height) to a reasonable maximum size. Then when the text changes the size of the Label doesn't need to. It also avoids the possibility of knock-on effects; like having to resize the main window, or move other controls around to accommodate the resized Label.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32:GUI Label resize
by hennesse (Beadle) on Oct 29, 2011 at 17:54 UTC | |
by BrowserUk (Patriarch) on Oct 30, 2011 at 01:18 UTC |