最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
开发手记(七)――实现图标首窗体的启动滞留
时间:2022-07-02 12:08:37 编辑:袖梨 来源:一聚教程网
大部分软件的主窗体启动之前,都有一个图标首窗体的启动,并且图标窗体与主窗体共存一段时间,您可以打开EXCEL亲身感受一下。
Option Explicit
Private 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 Long
Const HWND_TOPMOST = -1 '窗口置顶
Const SWP_SHOWWINDOW = &H40 '显示窗体
Const SWP_NOSIZE = &H1 '不允许改变大小
Private Sub Form_Load()
'设置窗体永远置顶
SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Top, Me.Left, Me.Width, Me.Height, SWP_NOSIZE Or SWP_SHOWWINDOW
End Sub
'Time1 and Time2 配合达到延时效果
Private Sub Timer1_Timer()
Timer2.Enabled = True
MDIForm1.Show
End Sub
Private Sub Timer2_Timer()
Unload Me
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Unload Me
MDIForm1.Show
End Sub
Private Sub Image1_Click()
Unload Me
MDIForm1.Show
End Sub
Option Explicit
Private 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 Long
Const HWND_TOPMOST = -1 '窗口置顶
Const SWP_SHOWWINDOW = &H40 '显示窗体
Const SWP_NOSIZE = &H1 '不允许改变大小
Private Sub Form_Load()
'设置窗体永远置顶
SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Top, Me.Left, Me.Width, Me.Height, SWP_NOSIZE Or SWP_SHOWWINDOW
End Sub
'Time1 and Time2 配合达到延时效果
Private Sub Timer1_Timer()
Timer2.Enabled = True
MDIForm1.Show
End Sub
Private Sub Timer2_Timer()
Unload Me
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Unload Me
MDIForm1.Show
End Sub
Private Sub Image1_Click()
Unload Me
MDIForm1.Show
End Sub
相关文章
- 《原神》5.2卡池抽取建议 11-14
- 《原神》5.2版本新怪物介绍 11-14
- 《原神》希诺宁增伤触发方法 11-14
- 《原神》循音觅奇活动入口 11-14
- 《原神》循音觅奇兑换码获取方法 11-14
- 《原神》花羽会活动飞行技巧介绍 11-14