Position relative to screen

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a way to find out when a form (which would normally fit within the
physical screen) is off the right edge of the screen and how much it needs
to be moved to the left to fit in the visible screen?

Thanks

Regards
 
Hi John,

On the form_load event, can you use a combination of
Me.WindowWidth and Me.WindowLeft.

When me.WindowLeft = 0, the left had side of the form should be at the left
hand side of the Microsoft Access .mdi window.

You could try code similar to the following to center the form as well.

Public Sub CenterForm(ByRef P_frmFormToBeCentered As Form)
On Error GoTo err_handler

P_frmFormToBeCentered.Top = (Screen.Height - P_frmFormToBeCentered.Height)
\ 2
P_frmFormToBeCentered.Left = (Screen.Width - P_frmFormToBeCentered.Width)
\ 2

err_handler:
If Err.Number <> 0 Then
Err.Source = Err.Source & " - basMain.CenterForm"
MsgBox "Error: " & Err.Number & " (" & Err.Description & ") " & _
"at " & Err.Source
End If 'End If Err.Number <> 0

End Sub 'End CenterForm
 
Hi John,

sorry, I didn't check that code sample:

me.windowtop = 0 will move the window as far left as you can without hiding
any on the left hand side.

Please ignore this code below, I was thinking of VB6 when I posted it
 
Back
Top