Fade Out Opacity Effect 
Author Message
 Fade Out Opacity Effect

Hi

Can anyone give me some code for a fade out effect using a form Opacity
property? I can't seem to get it working properly.....

thanks,

- David Angelovich



Tue, 07 Dec 2004 14:55:35 GMT  
 Fade Out Opacity Effect
Here ya go:

  Private Sub btnClose_Click( _
   ByVal sender As System.Object, _
   ByVal e As System.EventArgs) _
   Handles btnClose.Click
    Timer1.Enabled = True
  End Sub

  Private Sub Timer1_Tick( _
   ByVal sender As Object, _
   ByVal e As System.EventArgs) _
   Handles Timer1.Tick
    If Me.Opacity = 0 Then
      Me.Close()
    Else
      Me.Opacity -= 0.05
    End If
  End Sub

-- Mary
MCW Technologies
http://www.mcwtech.com

On Fri, 21 Jun 2002 16:55:35 +1000, "David Angelovich"

Quote:

>Hi

>Can anyone give me some code for a fade out effect using a form Opacity
>property? I can't seem to get it working properly.....

>thanks,

>- David Angelovich



Tue, 07 Dec 2004 22:31:24 GMT  
 Fade Out Opacity Effect
Perfect!

Thanks very much.

- David Angelovich


Quote:
> Here ya go:

>   Private Sub btnClose_Click( _
>    ByVal sender As System.Object, _
>    ByVal e As System.EventArgs) _
>    Handles btnClose.Click
>     Timer1.Enabled = True
>   End Sub

>   Private Sub Timer1_Tick( _
>    ByVal sender As Object, _
>    ByVal e As System.EventArgs) _
>    Handles Timer1.Tick
>     If Me.Opacity = 0 Then
>       Me.Close()
>     Else
>       Me.Opacity -= 0.05
>     End If
>   End Sub

> -- Mary
> MCW Technologies
> http://www.mcwtech.com

> On Fri, 21 Jun 2002 16:55:35 +1000, "David Angelovich"

> >Hi

> >Can anyone give me some code for a fade out effect using a form Opacity
> >property? I can't seem to get it working properly.....

> >thanks,

> >- David Angelovich



Tue, 07 Dec 2004 22:40:13 GMT  
 Fade Out Opacity Effect
Hi David,
Here's a code sample that shows how to fade in/out a form. Just drop a
button onto the form and write the following click event handler:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        Dim i As Double

        Me.Button1.Enabled = False
        For i = 1 To 0 Step -0.01
            System.Windows.Forms.Application.DoEvents()
            System.Threading.Thread.Sleep(10)
            Me.Opacity = i
        Next

        For i = 0 To 1 Step 0.01
            System.Windows.Forms.Application.DoEvents()
            System.Threading.Thread.Sleep(10)
            Me.Opacity = i
        Next
        Me.Button1.Enabled = True

    End Sub

Cheers,
Sean Draine
Visual Basic.NEt Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> Hi

> Can anyone give me some code for a fade out effect using a form Opacity
> property? I can't seem to get it working properly.....

> thanks,

> - David Angelovich



Wed, 08 Dec 2004 03:33:04 GMT  
 Fade Out Opacity Effect
We don't know exactly what you are trying to do with the Fade, but this
should point you in the right direction.

For i = 1 To 0 Step -0.1

Me.Opacity = i

Me.Refresh()

Application.DoEvents()

Next

Glen Kowalski, Elena Arzac, Ed Smith

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi

> Can anyone give me some code for a fade out effect using a form Opacity
> property? I can't seem to get it working properly.....

> thanks,

> - David Angelovich



Wed, 08 Dec 2004 03:35:05 GMT  
 Fade Out Opacity Effect


Quote:
> Hi David,
> Here's a code sample that shows how to fade in/out a form. Just drop a
> button onto the form and write the following click event handler:

>     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>         Dim i As Double

>         Me.Button1.Enabled = False
>         For i = 1 To 0 Step -0.01
>             System.Windows.Forms.Application.DoEvents()
>             System.Threading.Thread.Sleep(10)
>             Me.Opacity = i
>         Next

>         For i = 0 To 1 Step 0.01
>             System.Windows.Forms.Application.DoEvents()
>             System.Threading.Thread.Sleep(10)
>             Me.Opacity = i
>         Next
>         Me.Button1.Enabled = True

>     End Sub

I my app has more threads running, wouldn't system.threading.thread.sleep(10)
stop the hole programm for 10ms?
If so, I think that Mary Chipman's solution with the timer is better.

Marc



Wed, 08 Dec 2004 20:01:04 GMT  
 Fade Out Opacity Effect


Quote:
> We don't know exactly what you are trying to do with the Fade, but this
> should point you in the right direction.

> For i = 1 To 0 Step -0.1

> Me.Opacity = i

> Me.Refresh()

> Application.DoEvents()

> Next

But this works in different speeds on different computers.

Marc



Wed, 08 Dec 2004 23:45:05 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Fade-in, Fade-out effect

2. create a fade effect or any other effect like morph between two open forms

3. Opacity fading

4. Opacity fading

5. Fade effect in text mode...

6. Please help: Fade Effect for picturebox in Visual Basic .NET

7. Screen effects: fades, wipes, dissolves etc

8. How to obtain a fade effect?

9. How To: Fade effect title bar

10. Make a Picture fade effect

11. Real Fade-in and Fade-out

12. Fade-in and Fade-out of button controls

 

 
Powered by phpBB® Forum Software