Results 1 to 7 of 7

Thread: Borderless Form & Aero

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    5

    Borderless Form & Aero

    Hello,

    Searched for hours for an answer to this to no avail. So thought i'd give this forum a shot.

    My
    FormBorderStyle = Windows.Forms.FormBorderStyle.None

    I'm using this code to then create an aero blur. I have managed to create, at the top of my borderless form, my own title bar with AERO blurring. To do this, i've put a background to my form, a .PNG, which has a strip at the top cut out (transparent png)
    Code:
      
    Imports System.Runtime.InteropServices
    
    Public Class Form6
        <StructLayout(LayoutKind.Sequential)> _
        Private Structure DWM_BLURBEHIND
    
    
            Public dwFlags As Integer
            Public fEnable As Boolean
            Public hRgnBlur As IntPtr
            Public fTransitionOnMaximized As Boolean
        End Structure
        Private Const DWM_BB_ENABLE As Integer = &H1
        Private Const DWM_BB_BLURREGION As Integer = &H2
        Private Const DWM_BB_TRANSITIONONMAXIMIZED As Integer = &H4
        <DllImport("dwmapi.dll", PreserveSig:=False)> _
        Private Shared Sub DwmEnableBlurBehindWindow(ByVal hWnd As IntPtr, ByRef pBlurBehind As DWM_BLURBEHIND)
        End Sub
    
        Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    
    
            MyBase.OnLoad(e)
            'TextBox1.UseCompatibleTextRendering = True
    
    
            ''#Set the form's border style to None  
            Me.FormBorderStyle = FormBorderStyle.None
            ''#Whatever region that you fill with black will become the glassy region   
            ''# (in this example, the entire form becomes transparent)  
            Me.BackColor = Color.Black
            ''#Create and populate the blur-behind structure   
            Dim bb As DWM_BLURBEHIND
            bb.dwFlags = DWM_BB_ENABLE
            bb.fEnable = True
            bb.hRgnBlur = Nothing
            ''#Enable the blur-behind effect    
            DwmEnableBlurBehindWindow(Me.Handle, bb)
        End Sub
    
        
    End Class
    Sorry if it's not in order, just pasted it ruffly.

    It works. but my textboxs are all messed up as their background is now transparent.


    Is there actually any way to do this? Possibly just have DwmEnableBlurBehindWindow create the blur on a certain part of the form and not make the WHOLE form transparent??

    Thanks
    Hypez.
    Last edited by hypez; May 27th, 2011 at 12:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width