Creating a Glass(Clear) form

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts Page 1 of 1
Contributors
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

Creating a Glass(Clear) form
Code
Taking advantage of the windows aero theme.

Make a new application and import this code!

Code: Select all

Imports System.Runtime.InteropServices

Public Class Form1
    <Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> Public Structure MARGINS
        Public LeftWidth As Integer
        Public RightWidth As Integer
        Public TopHeight As Integer
        Public Buttomheight As Integer
    End Structure

    <Runtime.InteropServices.DllImport("dwmapi.dll")> Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As MARGINS) As Integer
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Me.BackColor = Color.Black
            Dim margins As MARGINS = New MARGINS
            margins.LeftWidth = -1
            margins.RightWidth = -1
            margins.TopHeight = -1
            margins.Buttomheight = -1
            Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, margins)
        Catch ex As Exception
            MsgBox("You need too use the windows aero style!", vbCritical, "Fatal Error")
            Application.Exit()
        End Try
    End Sub
End Class
Your welcome! Design away!
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
User avatar
Rookie
Top Poster
Top Poster
Posts: 85
Joined: Thu May 19, 2011 10:28 am

Re: Creating a Glass(Clear) form
Rookie
nerner;

thanks! great
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Creating a Glass(Clear) form
MrAksel
This tutorial have been posted many times, but since you are new you cant know about them, no -rep :D
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Creating a Glass(Clear) form
Agust1337
Why not instead of showing a messagebox, just return to the normal visual design?
Top-notch casual Dating
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

You can also use DwmEnableBlurBehindWindow for a similar effect:
Image
Code: Select all
    <StructLayout(LayoutKind.Sequential)> _
    Public Structure DWM_BLURBEHIND
        Public dwFlags As DwmBlurBehindDwFlags
        Public fEnable As Boolean
        Public hRgnBlur As IntPtr
        Public fTransitionOnMaximized As Boolean

        Sub New(ByVal _dwFlags As DwmBlurBehindDwFlags, ByVal _fEnable As Boolean, ByVal _hRgnBlur As IntPtr, ByVal _fTransitionOnMaximized As Boolean)
            dwFlags = _dwFlags
            fEnable = _fEnable
            hRgnBlur = _hRgnBlur
            fTransitionOnMaximized = _fTransitionOnMaximized
        End Sub
End Structure
    <Flags()> _
    Public Enum DwmBlurBehindDwFlags As UInteger
        DWM_BB_ENABLE = &H1
        DWM_BB_BLURREGION = &H2
        DWM_BB_TRANSITIONONMAXIMIZED = &H4
    End Enum
    <DllImport("dwmapi.dll")> _
    Private Shared Sub DwmEnableBlurBehindWindow(ByVal hwnd As IntPtr, ByRef blurBehind As DWM_BLURBEHIND)
    End Sub
Then use this code to use it:
Code: Select all
DwmEnableBlurBehindWindow(Me.Handle, New DWM_BLURBEHIND(DwmBlurBehindDwFlags.DWM_BB_ENABLE, True, Me.Handle, True))
http://www.megaapps.tk/
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

Re: Creating a Glass(Clear) form
clanc789
Or you use the cheatmasterbw aeroglasseffect.dll :))
Practice makes perfect!

VIP since: 6-10-2011
6 posts Page 1 of 1
Return to “Tutorials”