Fading in an image

I am looking for a way to have an image fade in.  What I need to have happen is:  when running the picture would appear blacked out, and have small squares reveal one at a time until the whole image is revealed.

Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is NOT a neat solution.  but might worth while trying this.  You have to put the image in an image control, not a picture box.  Need a image control called "Image1" and timer control called "Timer1"

Option Explicit

Dim imgIndex As Long
Dim Shape1(24) As Shape

Private Sub Form_Load()
    Dim i As Long
    Dim j As Long
    For i = 0 To 24
        Set Shape1(i) = Controls.Add("VB.Shape", "shape_" & i)
    Next i
    For i = 0 To 24
        Shape1(i).Width = Image1.Width / 5
        Shape1(i).Height = Image1.Height / 5
        Shape1(i).Move Int(i / 5) * Shape1(i).Width + Image1.Left, (i Mod 5) * Shape1(i).Height + Image1.Top
        Shape1(i).Visible = True
        Shape1(i).BackStyle = 0 'solid
        Shape1(i).FillStyle = 0 'solid
    Next i
End Sub

Private Sub ShowImage()
    Timer1.Interval = 50
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    Shape1(imgIndex).Visible = False
    imgIndex = imgIndex + 1
    If (imgIndex > 24) Then
        imgIndex = 0
        Timer1.Enabled = False
    End If
End Sub

Good Luck!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
theres two methods a hard an easy way. the hard way isnt too hard though. hard way is to use GetDiBits and get the images rgb values stored into an array and then get the difference between the colors and a certain percentage to add.
so if you want the images to go through 10 steps till they are completely faded into the other, if pic1's red value starts at 0 and pic2's is 100 for that particular pixel you take 100-0 = 100 then get 10 percent
= 10 and then next time youll get 20% of the difference until they = the same
you dont have to change anything for subtracting cause the number youll get with be negative, it'll work out
ie. pic1 red = 50 pic2 red = 25
25-50 = -25
so when you add a % of that youll be taking away from pic1'a red not adding.
quick easy way is to make a picturebox and set the backcolor to black then bitblt the image onto it using (i believe SRCPAINT) then set the picture a little whiter and do the same till its white
so have variables for red green and blue and keep incrementing and set the backcolor to RGB(red,green,blue)
then use bitblt and SRCPAINT
the pic will fade from black. im not 100% sure it's SRCPAINT i dont have any of my source code right now, i had to format my drive and my programming stuff hasnt been copied from a backup hard drive yet.
Hi egroegeinrub,
This old question (QID 20553028) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->Accept supunr's comments as answer

Please leave any comments here within the next seven days.


EE Cleanup Volunteer
nice code supunr.  Adding to my library
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.