NextGenEdit: Original Code By DFXBB's
Hi !
One of the most coolest features of Windows Vista/7 is its glass effect in Forms.
In this short tutorial I'll show you how to make your form entirely transparent. The difference is that by default Windows do transparency in title bar. But we can change that and apply the transparency to complete Form.
Here we go:
Create a new project.
Add this namespace:
Then add this:Code:Imports System.Runtime.InteropServices
Then declare the following API:Code:'This will declare margins for transparency of our window... <StructLayout(LayoutKind.Sequential)> _ Public Structure WinMargins Public LWidth As Integer Public THeight As Integer Public RWidth As Integer Public BHeight As Integer End Structure
Note: The following API is only present in Windows Vista /7
Now Double Click The Form and add the following code:Code:<DllImport("dwmapi.dll")> _ Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As WinMargins) As Integer End Function
Note: Transparency will not turned on unless you change the Form's back color to Black.Code:Dim margins As WinMargins = New WinMargins 'The value of -1 is used when you want to use full window as transparency... Dim WM As WinMargins = New WinMargins WM.LWidth = -1 WM.RWidth = -1 WM.THeight = -1 WM.BHeight = -1 'The handle of your window.. Dim handle As IntPtr = Me.Handle ' Finally call the API function by inputing window handle and your window margins .. DwmExtendFrameIntoClientArea(handle, WM)
Credits: MSDN for API DwmExtendFrameIntoClientArea Function (Windows)
Here's a screen shot:
Greetz, MJLover
Last edited by NextGen1; 03-27-2010 at 02:50 PM.
Awesome.
GOod tutorial
Woah VB can do everything!
Well written tutorial.
I'm back.
thanks for sharing
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MyNewSub()
End Sub
Sub MyNewSub()
TransparencyKey = BackColor
End Sub
End Class
something like that?

33
You're welcome. If I get time I'll write some more tutorials because Aero API is very rich and offers many other great effects
And yes VB can do anything. All .NET languages are equivalently powerful![]()
Last edited by MJLover; 03-27-2010 at 12:15 PM.
yo mang pm me back

382
Looks Great, thanks for sharing.

382
Thread Reopened, Credit to author added to post 1
Last edited by NextGen1; 03-27-2010 at 02:50 PM.
why06 (03-27-2010)
While this thread might be repoened lets get a couple things straight:
1. It's is not our responsibility to make sure you credit your sources.
2. It is not right to claim others work as your own, in order to make urself look good.
There is nothing wrong with sharing a tutorial that you found interesting, preferably not from a rival site though, but if you want to link to MSDN, or even share some interesting snippets that is no big deal, but you can not just outright use someone else's work without even attempting to mention them.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
wow it looks so cool but i cant get it to work (i think its cause i have XP)![]()
MJLover_2 (03-28-2010)