E
eBob.com
This is just driving me nuts. I have a really simple user control. It's
just a small textbox and small button. Created entirely in the designer.
No code. The size of the control is slightly less than 50x50. But after I
add it to a Panel, Panel.Controls.Add, it has a size of over 100x100 (but
less than the default user control size of 150,150). The textbox and button
are obviously about twice the size they should be. The object comes out of
the contructor the right size. In the next step I set the Location property
and after that the size is still OK. Then I add it to the panel and after
that the size has been corrupted and is over 100x100. If I change the code
to add a Label to the Panel, in place of the user control, that works fine.
If I add the user controls to the form, Me.Controls.Add, I have the same
problem. If I create a new but similar user control it has the same
problem.
I've created user controls before, but did I forget some step there?
How can a control have the right size immediately before calling
Controls.Add and the wrong size after that call?
Does anyone have any idea what might be going on?
Thanks, Bob
just a small textbox and small button. Created entirely in the designer.
No code. The size of the control is slightly less than 50x50. But after I
add it to a Panel, Panel.Controls.Add, it has a size of over 100x100 (but
less than the default user control size of 150,150). The textbox and button
are obviously about twice the size they should be. The object comes out of
the contructor the right size. In the next step I set the Location property
and after that the size is still OK. Then I add it to the panel and after
that the size has been corrupted and is over 100x100. If I change the code
to add a Label to the Panel, in place of the user control, that works fine.
If I add the user controls to the form, Me.Controls.Add, I have the same
problem. If I create a new but similar user control it has the same
problem.
I've created user controls before, but did I forget some step there?
How can a control have the right size immediately before calling
Controls.Add and the wrong size after that call?
Does anyone have any idea what might be going on?
Thanks, Bob