Support Forums

Full Version: [TuToRiAl] Fading In & Fading Out Effects on Open+Close [TuToRiAl]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(04-20-2011, 06:39 AM)KoBE Wrote: [ -> ]This code gets c/p everywhere. And everytime I have to ask...

Why do you have two different increments for each for loop?

Because we are fading in and out. Simple as that. If we fade in, we must start from zero and slowly increase to 1.x to allow the form to reveal itself on load. For fading out we want the form to slowly decrease its opacity as easy, so we divide the earlier numbers declared by the FadingOutProcess to allow the form to fade out.
(04-20-2011, 11:25 AM)The High Roller Wrote: [ -> ]Because we are fading in and out. Simple as that. If we fade in, we must start from zero and slowly increase to 1.x to allow the form to reveal itself on load. For fading out we want the form to slowly decrease its opacity as easy, so we divide the earlier numbers declared by the FadingOutProcess to allow the form to fade out.

You obviously don't understand what I'm saying...

What's 90 divided by 100?... .9 so instead of dividing on your 'fade out' effect. Why not set it...
Code:
For FadingOutProcess = 0.9 To 0.1 Step -0.1

You are much pretty doing the same thing... I don't see why you would have one code doing it normal. Then another dividing by 100. It just doesn't make any sense.
I used this in mine, except for I used different variables and such.
As KoBE has said, you should have had it as:

Code:
'Form Close Effect
Private Sub Form1_Close(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    For FadingOutProcess = 0.9 To 0.1 Step -0.1
        Me.Opacity = FadingOutProcess
        Me.Refresh()
        Threading.Thread.Sleep(70)
    Next
End Sub
(04-20-2011, 10:08 PM)Infinity Wrote: [ -> ]As KoBE has said, you should have had it as:

Code:
'Form Close Effect
Private Sub Form1_Close(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    For FadingOutProcess = 0.9 To 0.1 Step -0.1
        Me.Opacity = FadingOutProcess
        Me.Refresh()
        Threading.Thread.Sleep(70)
    Next
End Sub

Sure, why not. At least the code ain't broken. Confused
Whatever floats your boat. Wacko

(04-20-2011, 11:08 PM)The High Roller Wrote: [ -> ]Sure, why not. At least the code ain't broken. Confused
Whatever floats your boat. Wacko

Code isn't broken, but good programmers always clean up their code. Instead of making a list of strings individually for example, we use string arrays instead. It shortens the code, and makes things a bit tidier.
Never knew that. Going to give this a shot a little later.
Yeah, I've seen this a few times in some programs.

Nice share dude.
Smile
I never realized that this could be done in visual basics.
I love this, I've used it for like all my programs.
Pages: 1 2 3