|
-
Jun 18th, 2000, 09:28 AM
#2
Stayontop:
[/code]
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long) As Long
Public Const HWND_TOPMOST = -1
Public Const HWND_TOP = 0
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const flags = SWP_NOMOVE Or SWP_NOSIZE
Sub StayOnTop(TheForm As Form)
SetWinOnTop = SetWindowPos(TheForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, Flags)
End Sub
Use: Stayontop Me
[/code]
Center Form:
[/code]
Public Sub CenterForm(frmForm As Form)
With frmForm
.Left = (Screen.Width - .Width) / 2
.Top = (Screen.Height - .Height) / 2
End With
End Sub
Use: CenterForm Me
[/code]
This is just an example with any coordinates (form cannot be moved past the sides nor the top):
[/code]
f Me.Left < 700 Then Me.Left = 0
If Me.Left > 8500 Then Me.Left = Screen.Width - Width
If Me.Top < 700 Then Me.Top = 0
[/code]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|