Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to Change Transparency level of Your Form Using VB.Net

Author: DevASP
Download Source Code : 356_Transperancy_of_form.zip

This is a Tip for Programmers that how they can Change their Transparency of Window form by just scrolling mouse or on Button click.

Create a window application in VB.Net and drag two buttons on the form and now just write some lines of codes

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

    Me.BackColor = Color.Green

    Button1.Text = "Decrease"

    Button2.Text = "Increase"

 

End Sub

 

 

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

 

   If Me.Opacity > 0 Then

       Me.Opacity -= 0.05

   End If

 

End Sub

 

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 

   If Me.Opacity < 1 Then

       Me.Opacity += 0.05

   End If

 

End Sub

 

 

 

Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel

 

   If e.Delta > 0 Then

     If Me.Opacity < 1 Then

         Me.Opacity += 0.05

     End If

   Else

     If Me.Opacity > 0 Then

         Me.Opacity -= 0.05

     End If

   End If

 

End Sub

 

 

Private Sub Button1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseWheel

 

        If e.Delta > 0 Then

            If Me.Opacity < 1 Then

                Me.Opacity += 0.05

            End If

        Else

            If Me.Opacity > 0 Then

                Me.Opacity -= 0.05

            End If

        End If

 

End Sub

 

 

Private Sub Button2_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseWheel

 

        If e.Delta > 0 Then

            If Me.Opacity < 1 Then

                Me.Opacity += 0.05

            End If

        Else

            If Me.Opacity > 0 Then

                Me.Opacity -= 0.05

            End If

        End If

 

End Sub

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Log off, Restart and Shutdown your System Using VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net