Try this. Create 2 forms (frmSplash and frmMain). Add a picture box to frmSplash. Add a module to your project and set your Project Properties to have Startup Object to be Sub Main.
Change BorderStyle property for frmSplash to None. Copy this code to a module:
Code:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Sub Main()
Dim lRoundRgn As Long
Dim rc As RECT
Dim x As Long
Dim y As Long
Dim lTimer As Long
Load frmSplash
frmSplash.ScaleMode = vbPixels
Call GetClientRect(frmSplash.hwnd, rc)
x = frmSplash.Picture1.Width
y = frmSplash.Picture1.Height
lRoundRgn = CreateEllipticRgn(x, y, 5, 5)
SetWindowRgn frmSplash.Picture1.hwnd, lRoundRgn, True
frmSplash.Show
lTimer = Timer
Do While Timer < lTimer + 3
DoEvents
Loop
Unload frmSplash
frmMain.Show
End Sub
Copy this code to frmSplash:
Code:
Private Sub Form_Load()
PaintPictureRed Picture1
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Function PaintPictureRed(ByVal pOject As Object)
Dim i As Integer
Dim y As Integer
With pOject
.AutoRedraw = True
.DrawStyle = 6
.DrawMode = 13
.DrawWidth = 2
.ScaleMode = 3
.ScaleHeight = (256 * 2)
End With
'Paint it red to black
For i = 0 To 255
pOject.Line (0, y)-(pOject.Width, y + 2), RGB(i, 0, 0), BF
y = y + 2
Next i
End Function
Run your project.
Regards,
Edited by Serge on 03-09-2000 at 11:06 AM