有两个form,如何让其中一个form置前? 很多这样的例子,算后面的form被选中,前面的form还在前面。根对话框不一样,对话框,在前面的窗口不去掉的情况下还无法激活后面的form。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考:Option ExplicitPrivate 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) As LongPrivate Const SWP_NOMOVE = 2Private Const SWP_NOSIZE = 1Private Const HWND_TOPMOST = -1Private Const HWND_NOTOPMOST = -2Private Const SWP_NOACTIVATE = &H10Private Const SWP_SHOWWINDOW = &H40Private Const wFlags = SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE'始终放在前面Private Sub KeepOnTop(frmForm As Form) SetWindowPos frmForm.hWnd, HWND_TOPMOST, 0, 0, 0, 0, wFlagsEnd Sub'取消Private Sub RemoveOnTop(frmForm As Form) SetWindowPos frmForm.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, wFlagsEnd Sub 调用例子:Private Sub Command1_Click() KeepOnTop MeEnd SubPrivate Sub Command2_Click() RemoveOnTop MeEnd Sub 我在Modules里边写下面的代码为什么出错阿? Load Form2 Form2.Show 0, Form1 我说一个本办法,假如想一直让Form2在Form1的前面,在Form1的activate事件中写 if not Form2 is nothing and Form2.visible=true then Form2.Zorder end if这样,就可以了。不知道是不是你想要的效果。 VB6的collection对象添加自定义变量 vb msflexgrid控件冻结行或列 关于Excel中读取ini文件 从数据中读出图片 VB与VC中API中字符串类型的转换问题 菜问题:在线等待 如何获得文件默认外壳程序的图标... 事务滚回的问题 text1.text='abcdef/dddf/sefs',如何分別取得abcdef,dddf,sefs.誰手頭有相關函數 ICQ显示聊天记录的框是用的什么控件?textbox行不,还有他的颜色如何控制? 小弟实在是太菜了,望大虾赐教!^_^ 如何用VB编写一个简单的《客户关系管理系统》~急急急
Private Const SWP_NOSIZE = 1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const wFlags = SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE'始终放在前面
Private Sub KeepOnTop(frmForm As Form)
SetWindowPos frmForm.hWnd, HWND_TOPMOST, 0, 0, 0, 0, wFlags
End Sub'取消
Private Sub RemoveOnTop(frmForm As Form)
SetWindowPos frmForm.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, wFlags
End Sub
KeepOnTop Me
End SubPrivate Sub Command2_Click()
RemoveOnTop Me
End Sub
Load Form2
Form2.Show 0, Form1
写
if not Form2 is nothing and Form2.visible=true then
Form2.Zorder
end if
这样,就可以了。
不知道是不是你想要的效果。