如何让MDI父窗体中的某一个子窗体始终保持在最前端?

Herro 2002-01-22 12:14:44
如题,谢谢大家了。
...全文
119 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Herro 2002-01-24
  • 打赏
  • 举报
回复
to haogui0(好鬼):
是MDI窗体,用这个语句会出现runtime error 5

to playyuer(女㊣爱)
非常感谢。
w12 2002-01-23
  • 打赏
  • 举报
回复
Call Me.ZOrder(vbBringToFront)
playyuer 2002-01-23
  • 打赏
  • 举报
回复
例程下载:
http://microinfo.top263.net/Zip/MDI.zip


'不要用子窗体,用 SetParent 将普通 Form 设为 MDI 子窗体:
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Const GWL_STYLE = (-16)
Const WS_POPUP = &H80000000
Private Sub Form_Load()
Dim Ret As Long
Dim CurrentStyle As Long
Ret = SetParent(Me.hwnd, MDIForm1.hwnd)
CurrentStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
Ret = SetWindowLong(Me.hwnd, GWL_STYLE, CurrentStyle Or WS_POPUP)
End Sub
haogui0 2002-01-23
  • 打赏
  • 举报
回复
是只在本工程的最前面的话就很easy。用Show 0, frmMain就行。如果是想在所有的窗口的最前面用api好了。SetWindowPos CulDistance.hwnd, -1, 200, 200, 219, 87, SWP_NOMOVE Or SWP_NOSIZE。分拿来。呵呵。
Herro 2002-01-23
  • 打赏
  • 举报
回复
...
dbcontrols 2002-01-22
  • 打赏
  • 举报
回复
对不起,尽管我很想回答你的问题,但我要离开这里了,看看
http://www.csdn.net/Expert/topic/490/490851.shtm
就知道为什么了。
如果要找我,请到
http://www.d1vb.com

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧