autosize issue-VBForums
Results 1 to 3 of 3

Thread: autosize issue

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    596

    autosize issue

    Hi all,

    I have been playing with autosize and can not get it to work. the layout of the form is as so

    tablelayout with 1 coloum and 2 rows. top row contains flowlayout panel with 5 buttons left to right like a menu

    bottom row also contains a flowlayout panel that is empty.

    the tablelayout is set to fill the whole form
    both flowlayout panels are set to fill there sections of the tablelayout

    when button1 is pressed a second form gets added to the second flowlayoutpanel (in the bottom row) now no matter what i do or what settings/properties i change the second form never fills the whole flowlayout panel, it stays its original size.

    i have manaully set all to autosize and dock settings, see below

    Code:
            Form1.TopLevel = False
            FlowLayoutPanel1.Controls.Add(Form1)
            Form1.Dock = DockStyle.Fill
            Form1.Show()
            Form1.AutoSize = True
            Form1.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
    this is the code behind the button.

    please help. i dont know why its not working.

    ps i have tested with message boxes that the flowlayout panels are growing just not the form. i have also tried setting the forms height and width = the flowlayout panel upon the panels size changed event to no luck

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,559

    Re: autosize issue

    A form should not sit within any other control other than another form (I would say cannot sit, but I never know everything!). When this happens the main area becomes a MDI parent form. I have no idea what your code above would do . If you convert your Form1 into a user control, then you will get something more akin to what you seem to be asking for.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    596

    Re: autosize issue

    the code removes the form as a top level class so it can be put into the flow panel. How would one convert a form into a user control?

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.