dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB.NET
Expertise: Intermediate
Jan 20, 2004

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Funk Up Your Forms with Fading

I find this particularly useful in an MDI environment where you don't want to keep switching forms to read information—just make the front form transparent to read the one behind, then fade it in again. Much nicer than Alt+Tab!! Can also be used when quitting programs for a bit of extra class (no pun intended...)

Create a form with two buttons—btnFadeIn & btnFadeOut and execute the appropriate function.

Drop in the following code:


---------------------------
Private Function FadeIn()
   ' attach to BtnFadeIn_Click
   Dim start, finish As Double
   Dim i As Integer
   i = 1
   start = Microsoft.VisualBasic.DateAndTime.Timer
   finish = start + 2.0

   Do While Microsoft.VisualBasic.DateAndTime.Timer < finish
       If Me.Opacity < 1.0 Then
           Me.Opacity = ((i * 1) / 100)
           i = i + 1
       Else
           Exit Do
       End If
   Loop
End Function

Private Function FadeOut()
   ' attach to BtnFadeOut_Click - also Form1_Closing
   Dim start, finish As Double
   Dim i As Integer
   i = 1
   start = Microsoft.VisualBasic.DateAndTime.Timer
   finish = start + 1.0

   Do While Microsoft.VisualBasic.DateAndTime.Timer < finish
       If Me.Opacity > 0.25 Then
           Me.Opacity = ((100 - (i * 1)) / 100)
           i = i + 1
       Else
           Exit Do
       End If
   Loop
End Function
DevX Staff
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date