'''''''''''''''this ocde in module1'''''''''''''' Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Public Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPublic Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public Sub a(f As Form, m As Integer) Dim myrect As RECT Dim fwidth%, fheight%, i%, x%, y%, cx%, cy% Dim thescreen As Long Dim brush As Long GetWindowRect f.hwnd, myrect fwidth = (myrect.Right - myrect.Left) fheight = (myrect.Bottom - myrect.Top) thescreen = GetDC(0) brush = CreateSolidBrush(-10000) For i = 1 To m cx = fwidth * (i / m) cy = fheight * (i / m) x = myrect.Left + (fwidth - cx) / 2 y = myrect.Top + (fheight - cy) / 2 Rectangle thescreen, x, y, x + cx, y + cy Next x = ReleaseDC(0, thescreen) DeleteObject (brush) End Sub Public Sub b(f As Form, d As Integer, m As Integer, mm As Integer) Dim myrect As RECT Dim fwidth%, fheight%, i%, x%, y%, cx%, cy% Dim thescreen As Long Dim brush As Long GetWindowRect f.hwnd, myrect fwidth = (myrect.Right - myrect.Left) fheight = (myrect.Bottom - myrect.Top) thescreen = GetDC(0) brush = CreateSolidBrush(0) For i = m To 1 Step -1 cx = fwidth * (i / m) cy = fheight * (i / m) x = myrect.Left + (fwidth - cx) / 2 y = myrect.Top + (fheight - cy) / 2 Rectangle thescreen, x, y, x + cx, y + cy Next x = ReleaseDC(0, thescreen) DeleteObject (brush) End Sub '''''''''''''''this code in form''''''''''''''' Private Sub Command1_Click() Call b(Me, 2, 5000, 1) End End SubPrivate Sub Form_Load() Call a(Me, 5000) End Sub
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Public Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPublic Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Sub a(f As Form, m As Integer)
Dim myrect As RECT
Dim fwidth%, fheight%, i%, x%, y%, cx%, cy%
Dim thescreen As Long
Dim brush As Long
GetWindowRect f.hwnd, myrect
fwidth = (myrect.Right - myrect.Left)
fheight = (myrect.Bottom - myrect.Top)
thescreen = GetDC(0)
brush = CreateSolidBrush(-10000)
For i = 1 To m
cx = fwidth * (i / m)
cy = fheight * (i / m)
x = myrect.Left + (fwidth - cx) / 2
y = myrect.Top + (fheight - cy) / 2
Rectangle thescreen, x, y, x + cx, y + cy
Next
x = ReleaseDC(0, thescreen)
DeleteObject (brush)
End Sub
Public Sub b(f As Form, d As Integer, m As Integer, mm As Integer)
Dim myrect As RECT
Dim fwidth%, fheight%, i%, x%, y%, cx%, cy%
Dim thescreen As Long
Dim brush As Long
GetWindowRect f.hwnd, myrect
fwidth = (myrect.Right - myrect.Left)
fheight = (myrect.Bottom - myrect.Top)
thescreen = GetDC(0)
brush = CreateSolidBrush(0)
For i = m To 1 Step -1
cx = fwidth * (i / m)
cy = fheight * (i / m)
x = myrect.Left + (fwidth - cx) / 2
y = myrect.Top + (fheight - cy) / 2
Rectangle thescreen, x, y, x + cx, y + cy
Next
x = ReleaseDC(0, thescreen)
DeleteObject (brush)
End Sub
'''''''''''''''this code in form'''''''''''''''
Private Sub Command1_Click()
Call b(Me, 2, 5000, 1)
End
End SubPrivate Sub Form_Load()
Call a(Me, 5000)
End Sub