form resizing

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

Hello,

Ive got a form with 3 textboxes - one under the other. When I set the anchor
to top, left, right, and bottom for each of them and resize the form at
runtime, they change size in relation to the bottom of the form. This means
the textbox on top stretches underneath the textbox below it... if you get
my drift.

Is there a webpage or something that shows how to correctly set up a form to
maximise? Can it be set through the IDE? I cant get the damn thing to resize
properly.

Thankd for any help.
 
Hi Grant,

Don't know of any web pages, but you might want to put groups of controls in panels, and have the panels resize based on form change, and have the controls resize based on panel change.
 
Grant,

I usually create a TestForm in design mode, and will place controls and set
achor as well as other properties. Then i will copy paste the generated code
inside "InitializeComponent".

Shak.
 
kewl so what are those other properties that you set? If I have two text
boxes on my form and set the top textbox anchor to left, right and top - and
the bottom text box anchor to bottom, left, right - they get this big gap in
the middle when the form maximises. How do I get it so the two text boxes
look proportinally the same size no matter what size the form?

Thanks for your suggestions. sorry for my slow uptake.
 
Ok...

textbox1, textbox2, textbox3 must have the same anchor properties
left,top,right. Place textbox1, textbox2 and textbox3 one under other.

Add textbox3.width = textbox2.width = textbox1.width, during form load.

Now if you maximize the form....both will perfectly align, with same width
and no gaps.

Shak.
 
Hi Grant,
Hello,

Ive got a form with 3 textboxes - one under the other. When I set the anchor
to top, left, right, and bottom for each of them and resize the form at
runtime, they change size in relation to the bottom of the form. This means
the textbox on top stretches underneath the textbox below it... if you get
my drift.

Is there a webpage or something that shows how to correctly set up a form to
maximise? Can it be set through the IDE? I cant get the damn thing to resize
properly.

Thankd for any help.

Did your form should look like below?

+--------+---------+
| text1 | text2 |
+--------+---------+
| text3 |
| |
+--------+---------+

If your answer is yes.... then i can propose you to set anchors:

text1.Anchor=AnchorStyles.Top | AnchorStyles.Left;
text2.Anchor=AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
text3.Anchor=AnchorStyles.Top | AnchorStyles.Left
| AnchorStyles.Right | AnchorStyles.Bottom;

Give me feedback if "design" vision doesn't look like yours.

Regards

Marcin
 
Hey Marcini - this is what my form looks like:

The poroblem is the middle textbox.

+--------+---------+
| text1 |
+--------+---------+
| text2 |

+--------+---------+
| text3 |
+--------+---------+

cheers,
Grant
 
Hi Grant,

Hey Marcini - this is what my form looks like:

The poroblem is the middle textbox.

+--------+---------+
| text1 |
+--------+---------+
| text2 |

+--------+---------+
| text3 |
+--------+---------+

text1.Anchor=AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
text3.Anchor=AnchorStyles.Top | AnchorStyles.Left
| AnchorStyles.Right | AnchorStyles.Bottom;
text2.Anchor=AnchorStyles.Bottom | AnchorStyles.Left
| AnchorStyles.Right;

Cheers!

Marcin
 
Hi Grant,



text1.Anchor=AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
text2.Anchor=AnchorStyles.Top | AnchorStyles.Left
| AnchorStyles.Right | AnchorStyles.Bottom;
text3.Anchor=AnchorStyles.Bottom | AnchorStyles.Left
| AnchorStyles.Right;

(I replaced text2 with text3! - my fault!)

Cheers!

Marcin
 
Back
Top