I’ve got a really odd problem when changing the position of some labels.
In my software it’s possible to adjust the size of the font for different areas. On opening the font size and font name are changed for all affected controls in the parent control. There are labels with fixed text (Labels array) and some text is loaded from a database into a label subclass (DataLabels array). I calculate how I need to move the controls and then do the loop over the controls:
[code]'set data labels + labels
for currentControl as Integer = 0 to UBound(DataLabels)
Labels(currentControl).TextSize = hasFontsize
Labels(currentControl).TextFont = hasFont
DataLabels(currentControl).TextSize = hasFontsize
DataLabels(currentControl).TextFont = hasFont
Labels(currentControl).Top = Labels(currentControl).Top + (currentControl * (newStringHeight - oldStringHeight))
Labels(currentControl).Height = Labels(currentControl).TextSize *2
DataLabels(currentControl).Top = Labels(currentControl).Top
DataLabels(currentControl).Height = Labels(currentControl).Height
Labels(currentControl).Width = Labels(currentControl).Width + (newStringWidth - oldStringWidth)
DataLabels(currentControl).Left = DataLabels(currentControl).Left + (newStringWidth - oldStringWidth)
next[/code]
The Labels and the DataLabels obviously should have the same Top and Height. But they don’t:
I’ve checked and rechecked the code. The formula for the string height and widths hasn’t change and is correct. It doesn’t matter if the app is 32 or 64bit. I don’t understand why the Labels and the DataLabels behave differently.
Now if I change the window size the controls have the correct height:
I’ve tried to force a refresh but no dice. Does anyone have an idea what might cause this problem?