📄 8546.html
字号:
<html>
<head>
<title>Re: 请问如何才能使Form永远保持在最上层呢。</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Re: 请问如何才能使Form永远保持在最上层呢。</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by Someone on December 23, 1998 at 14:20:25:<p>
In Reply to: <a href="8541.html">请问如何才能使Form永远保持在最上层呢。</a> posted by poga on December 23, 1998 at 13:18:45:<p>
这个问题已经是老问题了!<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><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 8546-->
</ul><!--end: 8546-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -