7 Replies - 1220 Views - Last Post: 23 August 2012 - 08:52 PM Rate Topic: -----

#1 KeedonKing  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 12-July 12

Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 06:27 PM

Ok, so I have set up my forms to fade in and fade out on load, and Close. Form starts at 0 Opacity, and stops at 75 opacity with the help of Two timers FadeIn Timer And FadeOut Timer. Problem is this works great for one form. if I add another form The fade don't work for either. This is my code, seems like One is canceling out the other and the form loads to the full 100%

Public Class LoadScreen

    Private Sub Screen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LSFader.Enabled = True
        LCAccount.Show()
    End Sub

    Public Sub Timer1_Tick(sender As Object, e As EventArgs) Handles LSFader.Tick
        Me.Opacity += 0.05
        If Me.Opacity = 100 Then
            LSFader.Enabled = False
        End If
    End Sub
End Class


Is This A Good Question/Topic? 0
  • +

Replies To: Form Fade in Fade Out Opacity Issue

#2 KeedonKing  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 12-July 12

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 06:45 PM

This is my code with both Timers.... LSFadeIN, and LSFadeOUT

Public Class LoadScreen

    Private Sub Screen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LSFadeIN.Enabled = True
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles LSFadeIN.Tick
        Me.Opacity += 0.05
        If Me.Opacity = 100 Then
            LSFadeIN.Enabled = False
        End If
    End Sub

    Private Sub LSFadeOUT_Tick(sender As Object, e As EventArgs) Handles LSFadeOUT.Tick
        Me.Opacity -= 0.05
        If Me.Opacity = 0 Then
            End
        End If
    End Sub

    Private Sub ExitBtn_Click(sender As Object, e As EventArgs) Handles ExitBtn.Click
        LSFadeIN.Enabled = False
        LSFadeOUT.Enabled = True
    End Sub
End Class

Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1029
  • View blog
  • Posts: 4,008
  • Joined: 02-July 08

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 06:47 PM

Opacity is measured from 0.00 - 1.0 .
Was This Post Helpful? 0
  • +
  • -

#4 KeedonKing  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 12-July 12

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 06:54 PM

I've changed the Opacity to...

Me.Opacity += 0.03

Still same issue tho.
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1029
  • View blog
  • Posts: 4,008
  • Joined: 02-July 08

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 07:05 PM

So you left the Opacity = 100 part? This causes your sub to run much longer than you expect. If += .03 never = 100, or 1.0 if you changed that part, it will never stop.

This post has been edited by _HAWK_: 23 August 2012 - 07:05 PM

Was This Post Helpful? 0
  • +
  • -

#6 KeedonKing  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 12-July 12

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 07:19 PM

I see what your saying so what would I put to make it fade in to the full 100%? Im not sure on the math for this situation
Was This Post Helpful? 0
  • +
  • -

#7 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1029
  • View blog
  • Posts: 4,008
  • Joined: 02-July 08

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 08:08 PM

Re-read post#3. As far as math what ever number adding or subtracting that will = 0.00 or 1.00 then your good! It is also not good practice to use End to stop your application -> Me.Close or Application.Exit is much more preferred. You can also do this with 1 timer and a boolean that tell it to add or subtract as were fading in or fading out.
Was This Post Helpful? 0
  • +
  • -

#8 KeedonKing  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 12-July 12

Re: Form Fade in Fade Out Opacity Issue

Posted 23 August 2012 - 08:52 PM

Thanks Hawk... New to this.. But slowly learning man I appreciate your advice... Will see if I can work that out
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1