PDA

View Full Version : باز شدن فرم به صورت fade



sj2009
شنبه 02 خرداد 1388, 11:32 صبح
با سلام
می خوام زمانی که فرمم را باز می کنم به صورت محو از یک گوشه ی فرم شروع به باز شدن بشه تا زمانی که کاملاً فرم ظاهر بشه.
در سایت جستجو کردم ولی چیزی پیدا نکردم.
لطفاً کمک کنید.

M_P_1374
شنبه 02 خرداد 1388, 12:35 عصر
من از این کد استفاده میکنم
یه تایمر با اینتروال 10 بذارین


Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim Opacity

Private Sub Fade(ByVal Opacity)
Dim Retval As Long
Retval = GetWindowLong(hWnd, -20)
Retval = Retval Or 524288
SetWindowLong hWnd, -20, Retval
SetLayeredWindowAttributes hWnd, 0, Val(Opacity), 2
End Sub

Private Sub Form_Load()
Opacity = 0
End Sub

Private Sub Timer1_Timer()
If Opacity < 255 Then
Opacity = Opacity + 3
Fade Opacity
Else
Timer1.Enabled = True
End If
End Sub

red11011
شنبه 02 خرداد 1388, 13:07 عصر
بفرما

Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
Const AW_ACTIVATE = &H20000 'Activates the window.
Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
Private Sub Form_Load()
AnimateWindow Me.hwnd, 900, AW_HOR_POSITIVE Or AW_VER_POSITIVE
Me.Cls
End Sub