S
H
A
R
E

Thursday, May 26, 2011

VB net Transparent Form Background


VB.net AERO GLASS


THIS THE CODE:


Imports System.Runtime.InteropServices

Public Class Form1
    <StructLayout(LayoutKind.Sequential)> _
    Public Structure MARGINS
        Public cxLeftWidth As Integer
        Public cxRightWidth As Integer
        Public cyTopHeight As Integer
        Public cyButtomheight As Integer
    End Structure
    <DllImport("dwmapi.dll")> _
    Private Shared Function DwmExtendFrameIntoClientArea(ByVal hwnd As IntPtr, ByRef margin As MARGINS) As Integer
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim mg As MARGINS = New MARGINS
        mg.cxLeftWidth = -1
        mg.cxRightWidth = -1
        mg.cyTopHeight = -1
        mg.cyButtomheight = -1
        'set all value -1 to apply glass effect to the all of visible window
        Try
            DwmExtendFrameIntoClientArea(Me.Handle, mg)
        Catch ex As Exception
        End Try
    End Sub
End Class

2 comments:

Anonymous said...

Hi you!
I want to make form as you made, but i used c#.
Please take me how to make it.
(Sorry, my el is not good)
Thanks!

My Soccer Football said...

you can try this: http://win7aero.blogspot.com/2011/05/create-simple-form-with-aero-glass_26.html

Post a Comment