By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,463 Members | 774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,463 IT Pros & Developers. It's quick & easy.

Formatting of visual basic form is disturbed when form maximized

P: 2
I am starting to use visual basic for learning. I am facing this problem that when I maximize a form after placing some buttons and controls on it, the placement of all buttons and controls gets disturbed. Their location is completely messed up after maximizing the form. Please help. Thanks.
May 1 '15 #1
Share this Question
Share on Google+
3 Replies


Seth Schrock
Expert 2.5K+
P: 2,941
If you are using visual studio as your IDE, then check each control's Docked and Anchor properties. These are the properties that control what happens when the form is maximized. By default, the Docked property is empty and the Anchor property is set to top and left.
May 3 '15 #2

P: 2
Thanks seth. Yes dock and anchor property defines the placement of controls on form. But these have very limited options i-e top, fill and bottom etc. and secondly these have to be set for all the controls one by one.
When we maximize the screen, isn't there a way that the controls get maximized automatically, remaining at the same position on the form as these were before maximizing. As in the case of MS power point the inserted pictures, text and buttons gets maximized at the same location when we run the presentation, is there a way to fix their location in visual basic?
May 4 '15 #3

Seth Schrock
Expert 2.5K+
P: 2,941
I don't know of any setting that you can change to make that happen. The only way that I know of would be to calculate the size percentages of each control to the size of the form. For example, if when the form is small it is 400 by 300 and a textbox has the Top and Left settings at 10 and 10. When the form gets maximized lets say that it becomes 800 by 600 (yes this probably won't be the actual size, but it is easier to calculate in this hypothetical situation). Then you would need to change the Top and Left properties to 20 and 20. You would also have to do the same thing with the Height and Width properties. For every single control. You might find it easier to make it so that they can't maximize the form or just anchor everything to top and left. If you choose the later, all the controls should stay organized the same way, but you will have a big blank space in the bottom right corner of your form.
May 4 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.