9458.html
来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行
HTML
23 行
<html>
<head>
<title>Re: How to let form always on top in vb6</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Re: How to let form always on top in vb6</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by Someone on January 21, 1999 at 13:35:49:<p>
In Reply to: <a href="9454.html">How to let form always on top in vb6</a> posted by Fai on January 21, 1999 at 11:57:53:<p>
Option Explicit<br>Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _<br>ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _<br>ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long<p>Private Const HWND_TOPMOST = -1<br>Private Const HWND_NOTOPMOST = -2<br>Private Const SWP_NOSIZE = &H1<br>Private Const SWP_NOMOVE = &H2<p>Public Sub SetOnTop(frm As Form, Topmost As Boolean)<br>If Topmost Then<br>SetWindowPos frm.hwnd, HWND_TOPMOST, 0, 0, 0, _<br>0, SWP_NOSIZE Or SWP_NOMOVE<br>Else<br>SetWindowPos frm.hwnd, HWND_NOTOPMOST, 0, 0, 0, _<br>0, SWP_NOSIZE Or SWP_NOMOVE<br>End If<br>End Sub<br>以上的程式码放在一个 Module 中<p>在 Form_Load 中输入:<br>SetOnTop Me, True<p><br>若非MDIForm直接在Show后面加 1 即可<br>Form.Show 1 <br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 9458-->
</ul><!--end: 9458-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?