Aero Glass Screen Effect in VB.NET
Today, I will teach you how to create a program that has a screen effect of aero glass in vb.net. We often see an aero glass effect as a theme in windows 7.
Now, we will start the tutorial.
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only a Timer named Timer1 in your Form.
3. Then let's go to the code.
We will import Runtime.InteropServices library to access the operation services during runtime period.
- Imports System.Runtime.InteropServices
Next, create a Structure named side to declare values of the top, bottom, right side, and left side values.
- Public Structure side
- Public Left As Integer
- Public Right As Integer
- Public Top As Integer
- Public Bottom As Integer
- End Structure
Then we will import the dwmapi.dll as a Function named DwmExtendFrameIntoClientArea to access the Frame.
- <Runtime.InteropServices.DllImport("dwmapi.dll")> Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As side) As Integer
- End Function
In your Timer_Tick have this code below to maximize the opacity of your form.
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- If Me.Opacity.ToString() > 0 Then
- Me.Opacity = Me.Opacity.ToString() + 0.05
- End If
- End Sub
Then in your Form_Load, we will put values to our side as Structure and will access the result of DwmExtendFrameIntoClientArea then we will enable the time.
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.BackColor = Color.Black
- Dim side As side = New side
- side.Left = -1
- side.Right = -1
- side.Top = -1
- side.Bottom = -1
- Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, side)
- Catch ex As Exception
- End Try
- End Sub
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware