Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing SplashForm.frm (4.05 KB)
VERSION 5.00
Begin VB.Form SplashForm
BorderStyle = 1 'Fixed Single
ClientHeight = 1035
ClientLeft = 15
ClientTop = 15
ClientWidth = 5640
ClipControls = 0 'False
ControlBox = 0 'False
DrawMode = 6 'Mask Pen Not
DrawWidth = 3
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "SplashForm.frx":0000
MaxButton = 0 'False
MinButton = 0 'False
Picture = "SplashForm.frx":000C
ScaleHeight = 69
ScaleMode = 3 'Pixel
ScaleWidth = 376
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.Timer LoadTimer
Interval = 3000
Left = 0
Top = 0
End
End
Attribute VB_Name = "SplashForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetRegionData Lib "gdi32" (ByVal hRgn As Long, ByVal dwCount As Long, lpRgnData As Any) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Function GetBitmapRegion(cPicture As Object, cTransparent As Long)
Dim hRgn As Long, tRgn As Long
Dim x As Long, y As Long, X0 As Long
Dim hDC As Long, BM As BITMAP
hDC = CreateCompatibleDC(0)
If hDC Then
SelectObject hDC, cPicture
GetObject cPicture, Len(BM), BM
hRgn = CreateRectRgn(0, 0, BM.bmWidth, BM.bmHeight)
For y = 0 To BM.bmHeight
For x = 0 To BM.bmWidth
While x <= BM.bmWidth And GetPixel(hDC, x, y) <> cTransparent
x = x + 1
Wend
X0 = x
While x <= BM.bmWidth And GetPixel(hDC, x, y) = cTransparent
x = x + 1
Wend
If X0 < x Then
tRgn = CreateRectRgn(X0, y, x, y + 1)
CombineRgn hRgn, hRgn, tRgn, 4
DeleteObject tRgn
End If
Next x
Next y
GetBitmapRegion = hRgn
End If
DeleteDC hDC
End Function
Private Sub Command1_Click()
SetWindowRgn hWnd, GetBitmapRegion(Picture, vbWhite), True
End Sub
Private Sub DrawTimer_Timer()
Static iX As Single
If iX = 0 Then iX = 12
iX = iX + 1
'PSet (iX - 3, 49), RGB(Rnd * 256, Rnd * 256, Rnd * 256)
Me.Line (12, iX)-(400, iX), vbRed
If iX > 200 Then iX = 0
End Sub
Private Sub Form_Load()
SetWindowRgn hWnd, GetBitmapRegion(Picture, vbWhite), True
End Sub
Private Sub LoadTimer_Timer()
MainForm.Show
Unload Me
End Sub