Detecting form going off edge of screen

C

copyco

Does anyone have any suggestions on this? I have a form that can be
collapsed into a compact size and expanded back to full size. If the
user moves the compact size of the form close to the edge, then when it
is brought to full size, the right edge goes off the edge of the screen.
How can I code to adjust for this? If I code for checking for the
left edge and the size and being a certain distance from the right edge
of the screen, then it will only work for my current screen settings.
What if another user has different screen settings? Would I need to
have code to check the screen settings, or is there a better way to do
this? Thanks.
 
G

Guest

You can get the screen size from the Screen object and develop a general
formula for setting the left and top of your form when is is resized in the
onsizechange event.
 
C

copyco

Wow. I did not know there was a Screen object. Thanks, I got it.

If Me.Left + Me.Width > Screen.PrimaryScreen.Bounds.Right() Then
Me.Left = Screen.PrimaryScreen.Bounds.Right - Me.Width
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top