|
|
|
|
|
Dicas
|
|
Visual Basic (Forms/MDI)
|
|
|
Título da Dica: Efeito Explodindo Formulário
|
|
|
|
Postada em 24/7/2001 por shibito
shibito@zipmail.com.br
'Em um módulo.bas: Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'No formulário: Sub ExplodeForm(frm As Form, Optional ByVal lNumSteps As Long = 25, _ Optional ByVal lStepDuration As Long) Dim sngLeft As Single, sngTop As Single Dim sngHeight As Single, sngWidth As Single Dim sngNewHeight As Single, sngNewWidth As Single Dim sngHeightStep As Single, sngWidthStep As Single Dim iStep As Long
On Error Resume Next
'exit if the form is minimized/maximized If frm.WindowState <> vbNormal Then Exit Sub
'save current size and position sngLeft = frm.Left sngTop = frm.Top sngHeight = frm.Height sngWidth = frm.Width
'calc the step for the height/width increase sngHeightStep = sngHeight / lNumSteps sngWidthStep = sngWidth / lNumSteps
'resize the form in several steps For iStep = 1 To lNumSteps 'calc the new height/width sngNewHeight = sngNewHeight + sngHeightStep sngNewWidth = sngNewWidth + sngWidthStep ' display the form frm.Move sngLeft + (sngWidth - sngNewWidth) / 2, _ sngTop + (sngHeight - sngNewHeight) / 2, sngNewWidth, sngNewHeight frm.Visible = True frm.Refresh ' pause if so requested Sleep lStepDuration Next
' ensure that the form is completely visible frm.Move sngLeft, sngTop, sngWidth, sngHeight
End Sub
Private Sub Form_Load()
ExplodeForm Me, 50, 1
End Sub
|
|
|
|
|