Dreevoo.com | Online Learning and Knowledge Sharing
 
Home | Programs | Programming languages | Visual Basic | Windows Aero application window
Guest
Click to view your profile
Topics
Programs
Languages
Recipes
Home
Shortcuts
 
 

Windows Aero application window

We're going to create a Windows Aero style application window which can then be used as a basis for other applications.

 
  Author: mat | Version: 2010 | 4th November 2011 |  
 
 
1.
 

Open a new Windows Forms Application document.

 
 
2.
 

Double click the Form window to enter the code entry mode.

 
 
3.
 

Delete everything, you need an empty window (see picture) ...

 
 
4.
 

... and copy/paste the following code:

Imports System.Runtime.InteropServices

Public Class Form1

    <StructLayout(LayoutKind.Sequential)> Public Structure MARGINS
        Public Left As Integer
        Public Right As Integer
        Public Top As Integer
        Public Bottom As Integer
    End Structure

    <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
        Dim margins As MARGINS = New MARGINS
        margins.Left = -1
        margins.Right = -1
        margins.Top = -1
        margins.Bottom = -1
        Dim hwnd As IntPtr = Handle
        Dim result As Integer = DwmExtendFrameIntoClientArea(hwnd, margins)
        Me.BackColor = Color.Black

    End Sub

End Class

 
 
5.
 

Click Start Debugging button or press F5 to start the program.

 
 
6.
 

Your application, the Aero window should start right up.

The color of the window is the same as you Aero system color. This app will only run properly on a Windows Vista or Windows 7 System.

 
 
 
   
  Please login to post a comment
   
 
 
online learning made for people
Dreevoo.com | CONTRIBUTE | FORUM | INFO