Jumat, 27 Mei 2011

VB.net Transparasi Form (Aero Glass)

Simple Form With Aero Glass Effect
(*) Berjalan di Windows 7
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

0 comments:

Klampok Child | XKom | Win7Aero