Advertisement
tomjerry741

FadeIn & FadeOut to Your Form in Vb2008/2010

Mar 19th, 2012
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. after you create a new project
  2. right-click on soluation and Add then choose a New Module
  3. then
  4. baste this code in module tap & save it
  5. return to your main form and debug it and enjoy with Fade
  6. -------------------------------------------------------------------
  7. Module fadein_fadeout
  8. Public Sub fadein()
  9. Dim fade As Double
  10. For fade = 0.0 To 1.1 Step 0.1
  11. Form1.Opacity = fade
  12. Form1.Refresh()
  13. Threading.Thread.Sleep(1200)
  14. Next
  15. End Sub
  16.  
  17. Public Sub fadeout()
  18. Dim fade As Double
  19. For fade = 1.1 To 0.0 Step -0.1
  20. Form1.Opacity = fade
  21. Form1.Refresh()
  22. Threading.Thread.Sleep(1000)
  23. Next
  24. End Sub
  25. End Module
  26. ---------------------------
  27. Omg
  28. after you paste those code obove
  29. return to your main form1
  30. then
  31. type "paste" this code " to your Fadein and fadeout work
  32. i mean double click on form1 then paste this coding
  33. --------------------------------------------------------
  34.  
  35. Public Class Form1
  36.  
  37. Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  38. fadeout()
  39. End Sub
  40.  
  41. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  42. fadein()
  43. End Sub
  44.  
  45.  
  46. End Class
  47. -------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement