恩恩正解哦 添加一个无标题窗口,假设名称为FRM2 而启动窗体为FRM1 在FRM_LOAD事件中第一行就加入: FRM2.SHOW '显示这个无边框窗体(你的展示窗口) DOEVENTS '将处理移交操作系统,以便你的窗体显示出来以后才执行下面的代码 '这里就是你初始化的代码了 最后一行是 UNLOAD FRM2 '主窗体(程序)启动完毕,卸载展示窗口 就实现了一个LOGO窗体了.具体代码如下(两个FRM名称默认,FRM1为启动窗体,FRM2为展示窗体):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'测试前请设置form2居中显示(屏幕居中),即设置form2的startupposition=2 '测试前请设置展示窗体无边框,即Form2的BorderStyle属性为0 Private Sub Form_Load() '设置展示窗体位于最前,以便不被覆盖,这里不能用MODAL参数设置成模式窗体,否则无法继续执行下面语句 SetWindowPos Form2.hwnd, -1, 0, 0, 0, 0, 3 '显示展示窗体 Form2.Show '将操作权转交系统以便正确显示展示窗体 DoEvents '以下处理了启动代码 Form1.Left = 0 Form1.Top = 0 Form1.Height = Screen.Height Form1.Width = Screen.Width '为了演示方便,下面进行了延时 Dim t As Long t = Timer Do '在调试窗口显示倒计时 Debug.Print 5 - Int(Timer - t) DoEvents Loop Until Timer > t + 5 '处理启动代码完毕,可以卸载展示窗体,当然了,有些程序是在启动以后也不卸载展示,而是等待点击,把下面这行放到FROM2的CLICK事件中即可(这时可以用ME关键字来代替FORM2) Unload Form2 End Sub
设置窗体的BorderStyle = 0就可以了吧觉得太快, 就搞一个 TIMER 过5秒自动关闭
加一个frmsplash,写入一下代码Option Explicit Dim MyTimes As Integer Dim TimerEnd As Boolean Private Sub Form_Load() MyTimes = 0 Timer1.Enabled = True TimerEnd = True End Sub Private Sub Form_Unload(Cancel As Integer) FrmMain.Show End Sub Private Sub Timer1_Timer() If TimerEnd = False Then Exit Sub MyTimes = MyTimes + 1 If MyTimes >= 30 Then TimerEnd = False Timer1.Enabled = False Unload Me Set FrmSplash = Nothing 'Debug.Print "MyTimes: " & MyTimes Exit Sub End If ProgressBar1.Value = MyTimes TimerEnd = True End Sub 在sub main FrmSplash.Show end sub
添加一个无标题窗口,假设名称为FRM2
而启动窗体为FRM1
在FRM_LOAD事件中第一行就加入:
FRM2.SHOW '显示这个无边框窗体(你的展示窗口)
DOEVENTS '将处理移交操作系统,以便你的窗体显示出来以后才执行下面的代码
'这里就是你初始化的代码了
最后一行是
UNLOAD FRM2 '主窗体(程序)启动完毕,卸载展示窗口
就实现了一个LOGO窗体了.具体代码如下(两个FRM名称默认,FRM1为启动窗体,FRM2为展示窗体):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'测试前请设置form2居中显示(屏幕居中),即设置form2的startupposition=2
'测试前请设置展示窗体无边框,即Form2的BorderStyle属性为0
Private Sub Form_Load()
'设置展示窗体位于最前,以便不被覆盖,这里不能用MODAL参数设置成模式窗体,否则无法继续执行下面语句
SetWindowPos Form2.hwnd, -1, 0, 0, 0, 0, 3
'显示展示窗体
Form2.Show
'将操作权转交系统以便正确显示展示窗体
DoEvents
'以下处理了启动代码
Form1.Left = 0
Form1.Top = 0
Form1.Height = Screen.Height
Form1.Width = Screen.Width
'为了演示方便,下面进行了延时
Dim t As Long
t = Timer
Do
'在调试窗口显示倒计时
Debug.Print 5 - Int(Timer - t)
DoEvents
Loop Until Timer > t + 5
'处理启动代码完毕,可以卸载展示窗体,当然了,有些程序是在启动以后也不卸载展示,而是等待点击,把下面这行放到FROM2的CLICK事件中即可(这时可以用ME关键字来代替FORM2)
Unload Form2
End Sub
Dim MyTimes As Integer
Dim TimerEnd As Boolean
Private Sub Form_Load()
MyTimes = 0
Timer1.Enabled = True
TimerEnd = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMain.Show
End Sub
Private Sub Timer1_Timer()
If TimerEnd = False Then Exit Sub
MyTimes = MyTimes + 1
If MyTimes >= 30 Then
TimerEnd = False
Timer1.Enabled = False
Unload Me
Set FrmSplash = Nothing
'Debug.Print "MyTimes: " & MyTimes
Exit Sub
End If
ProgressBar1.Value = MyTimes
TimerEnd = True
End Sub
在sub main
FrmSplash.Show
end sub
还是窗体自带的属性
楼主可以选择一下啦!:)