【VB开源代码栏目提醒】:网学会员为需要VB开源代码的朋友们搜集整理了StayOnTop.Frm相关资料,希望对各位网友有所帮助!
VERSION 5.00
Begin VB.Form OnTop
BorderStyle = 1 'Fixed Single
Caption = "总在最前的窗体"
ClientHeight = 2040
ClientLeft = 1710
ClientTop = 1605
ClientWidth = 4065
Icon = "Stay On Top.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2040
ScaleWidth = 4065
Begin VB.Frame Frame1
Caption = "总在最前窗体"
Height = 1695
Left = 240
TabIndex = 0
Top = 240
Width = 3615
Begin VB.CommandButton Command2
Caption = "退出"
Height = 615
Left = 2040
TabIndex = 2
Top = 600
Width = 1215
End
Begin
VB.CommandButton Command1
Caption = "总在最前"
Height = 615
Left = 240
TabIndex = 1
Top = 600
Width = 1335
End
End
End
Attribute VB_Name = "OnTop"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private 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)
Private Sub Command1_Click()
Dim rtn
rtn = SetWindowPos(OnTop.hwnd, -1, 0, 0, 0, 0, 3)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
End Sub