Peter T has provided the code you need, but I would suggest that you
rethink whether you really want to always open the form such that it
covers the entire screen. As an end user, I would find that rather
annoying and frankly a bit rude. I would suggest that you use the code
on my web site to add a maximize button to the form's caption bar,
enable the form to be resized, and allow the user to maximize the form
if he so desires.
If you need to support multiple screen resolutions, you'll run into
problems when maximizing or resizing the form. Maximizing a form isn't
going to do the requisite resizing and/or repositioning the controls
that reside on the form. For example, suppose you have a form with
four textboxes in the upper region of the form. When you resize or
maximize the form, these controls will not move or resize themselves
to fit well within the new form size. Instead, they will remain in the
same position and have the same size as they had originally. The only
thing you get is a much larger form comprised almost completely by
empty space.
It is possible, but quite difficult, to resize and/or reposition the
controls on a form to make them look good on the expanded form. (This
type of thing is handled very very well in the WPF/XAML/NET3.5
framework.)
When you design a form that is to be used on monitors that may be of
different sizes and aspect ratios, it is best to develop for the
smallest for that you will support and leave the expanded spaces on
higher res screens alone. It is generally save to assume that your
users will be on 1024 x 1200 resolution, although you can't really
make any assumption about the aspect ratio -- it could be 4:3 for
"normal" monitors or 16:9 or 16:10 on widescreens.
I saw on Chip Petersons site
Who?
Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
I have a User Form that I need to adjust to fit the users computer. So far I
not found anyway to get the User Form Window to Adjust. I can adjust the User
Form sixe, but the Main Window the Form located is in is still bigger than
the Screen.
I saw on Chip Petersons site exactly what I need. His code allows complete
control over the User Form just as if it was a regular window.
Can anyone help me with this code?
http://www.cpearson.com/Excel/formcontrol.aspx
.