2 Attachment(s)
[.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Fairly simple, using the SetWindowTheme API call you can change the appearance of a couple controls so that they look a bit nicer:
Before:
Attachment 83275
After:
Attachment 83276
Code:
Code:
Public Class UnsafeNativeMethods
'//the character set needs to be Unicode
<DllImport("uxtheme.dll", CharSet:=CharSet.Unicode)> _
Friend Shared Function SetWindowTheme(ByVal hWnd As IntPtr, _
ByVal pszSubAppName As String, _
ByVal pszSubIdList As String) As Integer
End Function
End Class
Example implementation:
Code:
''' <summary>
''' Applies the explorer theme to the specified control.
''' </summary>
''' <param name="control">Indicates the control to apply the theme to.</param>
Public Function ApplyTheme(ByVal control As Control) As Integer
Return Me.ApplyTheme(control, "Explorer")
End Function
Private Function ApplyTheme(ByVal control As Control, ByVal theme As String) As Integer
Try
If control IsNot Nothing Then
If control.IsHandleCreated Then
Return UnsafeNativeMethods.SetWindowTheme(control.Handle, theme, Nothing)
End If
End If
Catch ex As DllNotFoundException
Return -1
End Try
Return -1
End Function
''' <summary>
''' Clears the applied theme from the specified control.
''' </summary>
''' <param name="control">Indicates the control to clear the theme from.</param>
Public Function ClearTheme(ByVal control As Control) As Integer
Return Me.ApplyTheme(control, String.Empty)
End Function
Re: [.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Re: [.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Good find there FA; gonna end up using this in my program :)
Re: [.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Quote:
Originally Posted by
formlesstree4
Good find there FA; gonna end up using this in my program :)
Yeah, it's for sure a nice little aesthetic thing you can do.
Re: [.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Is there a way to get this to work for ContextMenus? Or do I need to write another renderer?
Re: [.NET 1.0+] Explorer Themed Controls (Windows Aero Visuals)
Quote:
Originally Posted by
minitech
Is there a way to get this to work for ContextMenus? Or do I need to write another renderer?
Custom VisualStudio2008 style MenuStrip and ToolStrip Renderer