1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Visual Basic image fade

Discussion in 'Software Development' started by cowplopmorris, Apr 14, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. cowplopmorris

    cowplopmorris Thread Starter

    Joined:
    Jun 7, 2006
    Messages:
    105
    Hi,
    I've seen bits of answers around on this topic, but am still quite lost. If anyone could point me in the right direction, that would be great.

    Basically what I have is a Visual Basic Windows Forms project in Visual Studio 2008 with 2 PictureBoxes on top of one another and I want to be able to fade smoothly between them. At the moment I just have the top one have its visibility toggled, but is there any way to get them to fade?

    Any pointers or suggestions would be much appreciated.

    Thanks in advance.

    Edit: I'm looking at using 2 forms, each with a picture box, and changing the opacity of one of them using the Opactiy property. However, it's quite jerky unless you want to do a very slow fade, since the minimum timer interval is 1ms. If there's a better solution, I'd still be interested.
     
  2. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    I understand that the best way is to manipulate the two images directly, having dimensioned both as images or arrays of pixels. The final picturebox contents is set to the result after all the fiddling is done. I've been messing around with the same thing, but can't work out how to avoid doing each pixel individually (which slows EVERYTHING down for large images.)
     
  3. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    Also, don't criticise a 1ms timer interval, which is 1000 fps. The problem is that the computer can't render the blend that fast, hence my need for a more efficient manipulation routine.
     
  4. cowplopmorris

    cowplopmorris Thread Starter

    Joined:
    Jun 7, 2006
    Messages:
    105
    Yeah. I've found a bit of info ColorMatrix and the like, so I'll take a deeper look into that. I will be using full screen images for this, so I'm not sure what to do about the doing each pixel individually part.

    I realised this a while after posting. After doing some calculations and adjusting of figures, it seems that indeed it isn't actually running the code every ms, as the computer can't keep up.
     
  5. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    I don't know whether you've sorted it out yet. I've managed to do this though, and figured I may as well share it. It's not polished (it actually seems to fade too quickly!) but I hope it'll help.
     

    Attached Files:

  6. cowplopmorris

    cowplopmorris Thread Starter

    Joined:
    Jun 7, 2006
    Messages:
    105
    That looks good! I'll have a play with it and see if I can use it.

    I actually used another method. It was a bit of a bodge but worked. Basically a web browser object containing a simple web page with one function in, which used the proprietory MS filter. style.filter = "blendTrans(duration=0.7)"; etc. The app then passed it the next image url which it would display.

    But thanks anyway, I'll take a look.
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/916833

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice