How to give your program cool fading effects when you close \ load

Discussion in 'Programming General' started by The True Gears, Jul 23, 2008.

How to give your program cool fading effects when you close \ load
  1. Unread #1 - Jul 23, 2008 at 9:10 PM
  2. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    Put this code in Form1_load \ Form1_formclosing

    Code:
            Dim fade As Double
            For fade = 0.0 To 1.1 Step 0.1
                Me.Opacity = fade
                Me.Refresh()
                Threading.Thread.Sleep(100)
            Next
    Gives a pretty 1337 effect that most programs don't have :D
     
  3. Unread #2 - Jul 24, 2008 at 12:46 AM
  4. drainingpower
    Joined:
    Jan 15, 2008
    Posts:
    1,166
    Referrals:
    0
    Sythe Gold:
    0

    drainingpower Guru

    How to give your program cool fading effects when you close \ load

    thanks :D i will definitely use this in my programs
    good job
     
  5. Unread #3 - Jul 24, 2008 at 1:40 AM
  6. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    Thanks :D
     
  7. Unread #4 - Jul 24, 2008 at 3:38 PM
  8. Rah915
    Referrals:
    0

    Rah915 Guest

    How to give your program cool fading effects when you close \ load

    Form closing:
    Code:
    Dim fade As Double
            For fade = 1.1 To 0.0 Step -0.1
                Me.Opacity = fade
                Me.Refresh()
                Threading.Thread.Sleep(100)
            Next
    that will make it fade out instead of fade in.
     
  9. Unread #5 - Jul 25, 2008 at 6:32 AM
  10. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    How to give your program cool fading effects when you close \ load

    Terribly simple, however a lot of people seem to lack the ability to study such simple things, so I guess I can credit you for teaching.

    100ms sleep time is a bit much for fading. Perhaps 25 would do.
    Anyhow, converted to C#.

    fade in:
    Code:
    for(float fade = 0.0f; fade <= 1.1f; fade += 0.1f)
    {
        this.Opacity = fade;
        this.Invalidate();
        this.Update();
        System.Threading.Thread.Sleep(25);
    }
    fade out:
    Code:
    for(float fade = 1.1f; fade > 0.0f; fade -= 0.1f)
    {
        this.Opacity = fade;
        this.Invalidate();
        this.Update();
        System.Threading.Thread.Sleep(25);
    }
    I will point out that this is useless in Windows Vista, as the window manager already has such effects, except they are much more "aesthetically pleasing".
     
  11. Unread #6 - Jul 26, 2008 at 11:12 PM
  12. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    Don't bug me about it...my point of posted it was to help new users...doesn't mean im one
     
  13. Unread #7 - Jul 27, 2008 at 12:50 AM
  14. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    How to give your program cool fading effects when you close \ load

    I never said you were.
     
  15. Unread #8 - Jul 28, 2008 at 6:07 PM
  16. 8arry 5tinkt
    Referrals:
    0

    8arry 5tinkt Guest

    How to give your program cool fading effects when you close \ load

    wow this looks really cool :D
     
  17. Unread #9 - Jul 28, 2008 at 9:34 PM
  18. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    Thanks :D
     
  19. Unread #10 - Jul 28, 2008 at 9:38 PM
  20. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    With a splashScreen that looks epic :D
     
  21. Unread #11 - Oct 9, 2008 at 11:53 PM
  22. Kinglighter
    Joined:
    Aug 11, 2007
    Posts:
    102
    Referrals:
    0
    Sythe Gold:
    0

    Kinglighter Active Member

    How to give your program cool fading effects when you close \ load

    I' am new to VB and this totally rocks!
     
  23. Unread #12 - Nov 29, 2008 at 4:05 PM
  24. Cymru
    Joined:
    Jan 22, 2007
    Posts:
    693
    Referrals:
    0
    Sythe Gold:
    0

    Cymru Apprentice
    Banned

    How to give your program cool fading effects when you close \ load

    Thanks for the C# code :p
    this. never seems to work for me, but just putting opacity = fade; works
     
  25. Unread #13 - Nov 29, 2008 at 4:30 PM
  26. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    How to give your program cool fading effects when you close \ load

    'this' is the keyword which refers to the containing class.

    i.e. in a class called MyClass, with an integer member called 'myint', you could refer to myint like so:

    Code:
    this.myint
     
  27. Unread #14 - Nov 29, 2008 at 9:10 PM
  28. The True Gears
    Referrals:
    1

    The True Gears Guest
    $5 USD Donor

    How to give your program cool fading effects when you close \ load

    This thread is about as old as the internet, this is from when I actually cared about coding.

    I used to type like I was in 3rd grade ;_;
     
< So I've Been Trying To Make a VB6 Web Browser... | Youtube Downloader >

Users viewing this thread
1 guest


 
 
Adblock breaks this site