[2005] Odd things happen when resizing a custom control
I created a custom control consisting of two labels. When I resize the control, I want the second labels right edge to be aligned with the control's right edge.
However, when I put two of these controls on a form and resize one of them, the other one resizes also. And at a higher rate.
I have no idea why they are both resizing.
My code:
Code:
Private Sub DualBox_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
Me.tb.Width = Me.Width - Me.tb.Left
Me.Height = Me.l.Height
End Sub
l is the first label and tb is the second.
Any ideas?
Re: [2005] Odd things happen when resizing a custom control
Set tb to anchor left and right and position it where you want at design time....
And Im not sure how you want me.l to fit in with sizing the control, but from a WILD guess I would assume you might be using it to restrict the height of the control assuming me.l does not change height. if thats the case just use a set variable. otherwise maybe you could use the me.l's size changed event to set the controls height...
Re: [2005] Odd things happen when resizing a custom control
Basically, when I resize one DualBox control the other DualBox control resizes as well. I do not know how to explain it very well. I could make a video of it. Thanks.
Re: [2005] Odd things happen when resizing a custom control
Sorry for the irrelevant post, should have read your post again.
That is strange, are you using any layout controls or are any of the events, variables or controls used in setting the size shared?
Re: [2005] Odd things happen when resizing a custom control
I found out that both of the DualBox controls had their AutoSize property set to true. When I set even one of them to false then the problem stopped.