Control size change after Build

  • Thread starter Thread starter Steve Amey
  • Start date Start date
S

Steve Amey

Hi all

I have a Form that is inherited from a main form. On the child form I am
putting 2 panels directly on the form, not in any other controls. If I build
the project, 1 of the panels decides to re-size itself, but the other one
doesn't. Obviously, I don't want the panels re-sizing every time I perform a
build.

Has any-one encountered this behaviour at all? If I look at the code in the
form, the size of the panel is correct, but viewing it in the designer it
goes off the edge of the form cos the size is wrong.

Regards,
Steve.
 
Steve,

Have a look at the properties of the controls.
They may have Docking and Anchoring set.
The Dock property and Anchor property causes the control to hang on to the
edges of its parent control (Form) so it will strech/shrink to suit the form
size.

Doug
 
Hi Doug

Sorry, I should have been more descriptive in my first post. I know about
the Anchor and Dock properties and what they're used for, the problem is
that the control is re-sizing after a build, not after re-sizing the form
the control is on. The Anchor and Dock properties are set to None.

Imagine this, you have a form that has 2 Panel controls, you've just sized
them how you want them on the form. The form cannot be re-sized and the
Anchor and Dock properties are None (or Top, Left cos the behaviour after
the build is the same regardless). Everything looks good, you then build the
Assembly, and suddenly 1 of the Panel controls is re-sized so it stretches
beyond the size of the form. If you look at the Properties of the Panel in
the Designer it states the Size is (482, 296) when you want the Size to be
(408, 32), if you look in the Code window the Size of the control is set to
(408, 32) which is what you want it to be. I just can't understand why the
control suddenly decides to re-size on the form after a Build, and it's only
1 control as well, the other one remains fine!

Have you any idea why this is happening??

Regards,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top