Height and width on items on form

lincstech
lincstech used Ask the Experts™
on
Hello,

I need some help on the height and width issue of items on my form. Currently I've tried anchoring two picture boxes on my form so that they are split 50 /50 as outlined in the design but with no luck as the two picture boxes are all over the place.

Design
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014

Commented:
Hi,

Go to Tools | Options to display the Options dialog box. On the left side, select Windows Forms Designer. On the right, under Layout Settings, set Show Grid to true.

Author

Commented:
That was already selected. If you take a look at this image on the left the picture box has been anchored to the top and left and on the right the picture box has been anchored to the top and right, however there is a big gap in the middle. It's this gap that I'm struggling to fill. this happens when the form is debugged.

imgae
Most Valuable Expert 2012
Top Expert 2014

Commented:
Try anchoring both to "Top, Left, Right".

Author

Commented:
Did that and I also added this code but they just overlap

 picturebox1.Width = picturebox2.Width / 2 

Open in new window

High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
No amount of Dock/Anchor is going to get a 50/50 split that properly resizes with the form.  This is exactly what the TableLayoutPanel() control is for!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial