⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stay on top.frm

📁 演示如何将一个form始终放在最前面(3KB)
💻 FRM
字号:
VERSION 4.00
Begin VB.Form OnTop 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Stay On Top"
   ClientHeight    =   2385
   ClientLeft      =   1710
   ClientTop       =   1890
   ClientWidth     =   4860
   Height          =   3075
   Icon            =   "Stay On Top.frx":0000
   Left            =   1650
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2385
   ScaleWidth      =   4860
   Top             =   1260
   Width           =   4980
   Begin VB.Label Label1 
      Caption         =   "This is your program."
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1575
   End
   Begin VB.Menu mnuoptions 
      Caption         =   "&Options"
      Begin VB.Menu mnustayontop 
         Caption         =   "&Stay On Top"
      End
      Begin VB.Menu mnuspace 
         Caption         =   "-"
      End
      Begin VB.Menu munexit 
         Caption         =   "&Exit"
      End
   End
End
Attribute VB_Name = "OnTop"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()

Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'centre the form on the screen

'This project was downloaded from
'
'http://www.brianharper.demon.co.uk/
'
'Please use this project and all of its source code however you want.
'
'UNZIPPING
'To unzip the project files you will need a 32Bit unzipper program that
'can handle long file names. If you have a latest copy of Winzip installed
'on your system then you may use that. If you however dont have a copy,
'then visit my web site, go into the files section and from there you can
'click on the Winzip link to goto their site and download a copy of the
'program. By doing this you will now beable to unzip the project files
'retaining their proper long file names.
'Once upzipped, load up your copy of Visual Basic and goto
'File/Open Project. Locate the project files to where ever you unzipped
'them, then click Open. The project files will be loaded and are now ready
'for use.
'
'THE PROJECT
'This project can be very useful when when of your programs needs to stay
'on top of all other programs no matter what. The project needs just a
'couple of lines of code to work correctly and only one Windows API call
'is used.
'
'NOTES
'I have only provided the necessary project files with the zip. This keeps
'the size of the zip files down to a minimum and enables me to upload more
'prjects files to my site.
'
'I hope you find the project usful in what ever you are programming. I
'have tried to write out a small explanation of what each line of code
'does in the project, although most of it is pretty simple to understand.
'
'If you find any bugs in the code then please dont hesitate to Email me and
'I will get back to you as soon as possible. If you however need help on a
'different matter concerning Visual Basic then please please Email me as
'I like to here from people and here what they are programming.
'
'My Email address is:
'Brian@brianharper.demon.co.uk
'
'My web site is:
'http://www.brianharper.demon.co.uk/
'
'Please visit my web site and find many other useful projects like this.
'

End Sub

Private Sub mnustayontop_Click()

Dim rtn

If mnustayontop.Checked = False Then
   rtn = SetWindowPos(OnTop.hwnd, -1, 0, 0, 0, 0, 3)
   mnustayontop.Checked = False
Else
   rtn = SetWindowPos(OnTop.hwnd, -2, 0, 0, 0, 0, 3)
   mnustayontop.Checked = True
End If

End Sub

Private Sub munexit_Click()

Unload Me 'exit the program

End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -