Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TuToRiAl] Fading In & Fading Out Effects on Open+Close [TuToRiAl]
#11
(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.
[Image: t5BWm.png]
Reply
#12
(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.
Reply
#13
I used this in mine, except for I used different variables and such.
Reply
#14
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
Reply
#15
(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

[Image: t5BWm.png]
Reply
#16
(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.
Reply
#17
Never knew that. Going to give this a shot a little later.
[Image: rara.png]
Reply
#18
Yeah, I've seen this a few times in some programs.

Nice share dude.
Smile
Reply
#19
I never realized that this could be done in visual basics.
Reply
#20
I love this, I've used it for like all my programs.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [HELP]Tutorial/Learning System[HELP] norBATman 2 1,095 09-08-2012, 10:17 PM
Last Post: AceInfinity
  [TuToRiAl] How to make Offline (No Internet) Captcha (Human Confirmation) [TuToRiAl] Resistance 24 11,023 08-30-2012, 10:14 PM
Last Post: Resistance
  [Visual Basic] FTP Uploader [Tutorial] Coding Support 6 2,770 08-12-2012, 12:36 AM
Last Post: Kenneth
  [RELEASE]SF-TutPad "Tutorial Editor" [RELEASE] Digital-Punk 28 8,929 08-11-2012, 11:25 PM
Last Post: Kenneth
  Emailer Tutorial dunlop03 12 2,441 06-24-2012, 04:33 AM
Last Post: kpn37z

Forum Jump:


Users browsing this thread: 1 Guest(s)