Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

 

Option Explicit

 
'Mike McGrath
'mikem@clara.net
'(UK) 1998:
'This example opens form by increment steps to reach the forms set size.
'The attached sample is in VB6 but you can cut and paste this into your VB5
'and possibly VB4/32 projects.

 
Rem define type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

 
Rem declare api calls
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private 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
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long

 
'=======================================================================
Private Sub Explode(Newform As Form, Increment As Integer)

 
im Size As RECT ' setup form as rect type
GetWindowRect Newform.hwnd, Size

 
im FormWidth, FormHeight As Integer ' establish dimension variables
FormWidth = (Size.Right - Size.Left)
FormHeight = (Size.Bottom - Size.Top)

 
Dim TempDC
empDC = GetDC(ByVal 0&) ' obtain memory dc for resizing

 
im Count, LeftPoint, TopPoint, nWidth, nHeight As Integer ' establish resizing variables
or Count = 1 To Increment ' loop to new sizes
nWidth = FormWidth * (Count / Increment)
nHeight = FormHeight * (Count / Increment)
LeftPoint = Size.Left + (FormWidth - nWidth) / 2
TopPoint = Size.Top + (FormHeight - nHeight) / 2
Rectangle TempDC, LeftPoint, TopPoint, LeftPoint + nWidth, TopPoint + nHeight ' draw rectangles to build form
Next Count

 
eleteDC (TempDC) ' release memory resource

 
End Sub

 
'=======================================================================
Private Sub Form_Load()

 
xplode Me, 1000 ' open this form by number of desired increment

 
End Sub


Downloads

In IE right-click and select 'Save Target As...' or in Netscape right-click and select 'Save Link As...'

 

View Plain Text View Plain Text
Download Demo Project Download Demo Project
View Code Online Not Available





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.