|
-
May 27th, 2011, 01:30 AM
#1
Thread Starter
New Member
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.
-
May 27th, 2011, 11:33 AM
#2
Thread Starter
New Member
Re: Borderless Form & Aero
-
May 27th, 2011, 12:36 PM
#3
Thread Starter
New Member
Re: Borderless Form & Aero
Ok, managed to get labels to show OK.
By using:
Code:
Label1.UseCompatibleTextRendering = True
However, I need textboxes to appear correctly, and there is no
Textbox1.UseCompatibleTextRendering 
Anyone have any alternatives ??
-
May 27th, 2011, 12:54 PM
#4
Thread Starter
New Member
Re: Borderless Form & Aero
Added this to ApplicationEvents.vb
Code:
Namespace My
' The following events are availble for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Protected Overloads Shared ReadOnly Property UseCompatibleTextRendering() As Boolean
Get
' Use the GDI+ text rendering engine.
Return True
End Get
End Property
End Class
End Namespace
Labels display fine, textbox still transparent 
Any ideas please!
-
May 27th, 2011, 02:39 PM
#5
Re: Borderless Form & Aero
Sounds like a Transparency Key issue...
-
May 27th, 2011, 02:44 PM
#6
Re: Borderless Form & Aero
Here's an alternative, but it's not one everyone likes: host all the controls on a separate (borderless, transparent) form which is owned by the Aero blurring form. For an illustration of the kind of thing I am talking about, see this thread. You might find it easy to adapt the code I posted in #4. But I hope you'll find the ensuing discussion interesting too.
BB
-
May 27th, 2011, 03:00 PM
#7
Thread Starter
New Member
Re: Borderless Form & Aero
I've tried changing the trans key to lots of different colours. I was thinking about using 2 forms on top of each other, is that what you mean? Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|