We help IT Professionals succeed at work.

How to use the api animatewindow for slide a picturbox on win98?

sky100
sky100 asked
on
I use the api "animatewindow" for to slide a picturebox on my form.I use the code:

Private Sub Command1_Click()
picturebox1.visible=false

animatewindow picturebox.hwnd,300,AW_HOR_NEGATIVE+AW_SLIDE
picturebox.visible=true
End Sub

But i found the thing that the slideing picturebox have  blurred picture.The phenomena is in evidence when the picaturebox is container that it contain some controls.

I hope I can use animatewindow to slide picturebox and it keep clarity in slideing.

I use it on the windows98.Please help me!  
Comment
Watch Question

Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Hi sky100,

Maybe you need to change the Flags value..

Don't know the example below helps or not?:

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()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Set the graphic mode to persistent
    Me.AutoRedraw = True
    Me.Print "Unload me"
End Sub
Private Sub Form_Unload(Cancel As Integer)
    'Animate the window
    AnimateWindow Me.hwnd, 200, AW_VER_POSITIVE Or AW_HOR_NEGATIVE Or AW_HIDE
    'Unload our form completely
    Set Form1 = Nothing
End Sub

regards.

Author

Commented:
Hi! ryancys

thank you for your advice,But it can not help me.I had know all Flags value when i use the animatewindow.I only need the AW_HOR_NEGATIVE+AW_SLIDE.

thank you!

regards.
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Hi sky100,

As modified your codes, I found nothing abnormal:

Private Sub Command1_Click()
picturebox1.Visible = False

AnimateWindow picturebox1.hwnd, 300, AW_HOR_NEGATIVE + AW_SLIDE
picturebox1.Picture = Image1.Picture
picturebox1.Visible = True
End Sub

So, can you explain more details on what's your problem.

Thank you and regards.

Author

Commented:
Hi! ryancys
thank you for your help.

my picturebox is a container,it contain some controls.For examole flexgrid,listview etc.when the picturebox slideing,the image of the picturebox is illegible.
the picture has not picture,it only use to be a container by me.

If i use animatewindow to slide the container,the picture is illegible.

thank you!

regards

   
CERTIFIED EXPERT
Author of the Year 2009

Commented:
Hi sky100,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

sky100, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
Per recommendation, points refunded and question closed.

Netminder
CS Moderator