Fairly simple, using the SetWindowTheme API call you can change the appearance of a couple controls so that they look a bit nicer:
Before:
After:
Code:
Example implementation: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
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




Reply With Quote
