Results 1 to 5 of 5

Thread: [2005] Odd things happen when resizing a custom control

  1. #1

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    [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?
    Prefix has no suffix, but suffix has a prefix.

  2. #2
    Hyperactive Member cptHotkeys's Avatar
    Join Date
    Apr 2007
    Location
    New Zealand
    Posts
    294

    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...

    Signatures suck

  3. #3

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    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.
    Prefix has no suffix, but suffix has a prefix.

  4. #4
    Hyperactive Member cptHotkeys's Avatar
    Join Date
    Apr 2007
    Location
    New Zealand
    Posts
    294

    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?

    Signatures suck

  5. #5

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    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.
    Prefix has no suffix, but suffix has a prefix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width