?
Solved

Form & visual effect

Posted on 1999-10-27
6
Medium Priority
?
178 Views
Last Modified: 2010-05-18
Welcome to my question,

    I want to add some visual form's effect on my VB6 application like reduce magnitude gradually or flashing before show down.

PS:
I'll start this out at 30 points  and increase depending upon the comments given.
0
Comment
Question by:jhc73
6 Comments
 
LVL 2

Expert Comment

by:ventond
ID: 2162360
As far as I know you can do whatever you want in your Form_Unload event. If you want to paint the Mona Lisa on your form at unload go ahead.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2162398
See http://www.planet-source-code.com/vb

And do a search for form effects. There are all sorts available.
0
 
LVL 10

Accepted Solution

by:
caraf_g earned 90 total points
ID: 2162408
There are so many things you can do, but they're all based on the same principle.

The following is code that lets your form dwindle away. If you want any other effects, just modify.

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Dim dblDiff As Double
dblDiff = Height - ScaleHeight

Dim intSpeed As Integer
intSpeed = 2

If UnloadMode = vbManual Then
    Do While Height > dblDiff
        Height = Height - intSpeed * Screen.TwipsPerPixelY * 2
        Width = Width - intSpeed * Screen.TwipsPerPixelX * 2
        Top = Top + intSpeed * Screen.TwipsPerPixelY
        Left = Left + intSpeed * Screen.TwipsPerPixelX
        DoEvents
    Loop
End If

End Sub
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 4

Expert Comment

by:Juilette
ID: 2162902
'implode explode form

Option Explicit

#If Win16 Then
    Type RECT
        Left As Integer
        Top As Integer
        Right As Integer
        Bottom As Integer
    End Type
#Else
    Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
#End If

'User and GDI Functions for Explode/Implode to work

#If Win16 Then
    Declare Sub GetWindowRect Lib "User" (ByVal hwnd As Integer, lpRect As RECT)
    Declare Function GetDC Lib "User" (ByVal hwnd As Integer) As Integer
    Declare Function ReleaseDC Lib "User" (ByVal hwnd As Integer, ByVal hdc As Integer) As Integer
    Declare Sub SetBkColor Lib "GDI" (ByVal hdc As Integer, ByVal crColor As Long)
    Declare Sub Rectangle Lib "GDI" (ByVal hdc As Integer, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer)
    Declare Function CreateSolidBrush Lib "GDI" (ByVal crColor As Long) As Integer
    Declare Function SelectObject Lib "GDI" (ByVal hdc As Integer, ByVal hObject As Integer) As Integer
    Declare Sub DeleteObject Lib "GDI" (ByVal hObject As Integer)
#Else
    Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
    Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
    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
    Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    Declare Function SelectObject Lib "user32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
#End If



Sub ExplodeForm(f As Form, Movement As Integer)
    Dim myRect As RECT
    Dim formWidth%, formHeight%, i%, X%, Y%, Cx%, Cy%
    Dim TheScreen As Long
    Dim Brush As Long
   
    GetWindowRect f.hwnd, myRect
    formWidth = (myRect.Right - myRect.Left)
    formHeight = myRect.Bottom - myRect.Top
    TheScreen = GetDC(0)
    Brush = CreateSolidBrush(f.BackColor)
   
    For i = 1 To Movement
        Cx = formWidth * (i / Movement)
        Cy = formHeight * (i / Movement)
        X = myRect.Left + (formWidth - Cx) / 2
        Y = myRect.Top + (formHeight - Cy) / 2
        Rectangle TheScreen, X, Y, X + Cx, Y + Cy
    Next i
   
    X = ReleaseDC(0, TheScreen)
    DeleteObject (Brush)
   
End Sub


Public Sub ImplodeForm(f As Form, Direction As Integer, Movement As Integer, ModalState As Integer)

   
    Dim myRect As RECT
    Dim formWidth%, formHeight%, i%, X%, Y%, Cx%, Cy%
    Dim TheScreen As Long
    Dim Brush As Long
   
    GetWindowRect f.hwnd, myRect
    formWidth = (myRect.Right - myRect.Left)
    formHeight = myRect.Bottom - myRect.Top
    TheScreen = GetDC(0)
    Brush = CreateSolidBrush(f.BackColor)
   
        For i = Movement To 1 Step -1
        Cx = formWidth * (i / Movement)
        Cy = formHeight * (i / Movement)
        X = myRect.Left + (formWidth - Cx) / 2
        Y = myRect.Top + (formHeight - Cy) / 2
        Rectangle TheScreen, X, Y, X + Cx, Y + Cy
    Next i
   
    X = ReleaseDC(0, TheScreen)
    DeleteObject (Brush)
       
End Sub

'<<<<<<<<<<<<<<<  Form Code  >>>>>>>>>>>>>>>>>>>>>>

'unload event

    Call ImplodeForm(Me, 2, 500, 1)
    Set Form1 = Nothing
    unload me      


'load event
      Call ExplodeForm(Me, 500)



0
 

Author Comment

by:jhc73
ID: 2177515
Thanks.

Juilette, check for points...
0
 
LVL 4

Expert Comment

by:Juilette
ID: 2177604
Thanks....now I remember.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question