Click here to Skip to main content
15,896,496 members
Articles / Desktop Programming / Windows Forms

ZipTrack

Rate me:
Please Sign up or sign in to vote.
4.86/5 (28 votes)
2 Dec 2009CPOL5 min read 59.5K   782   78  
A comprehensive way to manage all of your downloaded zip files.
Imports System
Imports System.ComponentModel
Imports System.Runtime.CompilerServices
Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles

Namespace Gui.Components

    <ToolboxItem(False)> _
    Public Class BaseStyledPanel
        Inherits ContainerControl
        Private Shared renderer As New ToolStripProfessionalRenderer()

        Public Event ThemeChanged As EventHandler

        Public Sub New()
            MyBase.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
            MyBase.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
            MyBase.SetStyle(ControlStyles.ResizeRedraw, True)
            MyBase.SetStyle(ControlStyles.UserPaint, True)
        End Sub

        Protected Overrides Sub OnSystemColorsChanged(ByVal e As System.EventArgs)
            MyBase.OnSystemColorsChanged(e)
            Me.UpdateRenderer()
            MyBase.Invalidate()
        End Sub

        Protected Overridable Sub OnThemeChanged(ByVal e As System.EventArgs)
            If Me.ThemeChangedEvent IsNot Nothing Then
                RaiseEvent ThemeChanged(Me, e)
            End If
        End Sub

        Private Sub UpdateRenderer()
            If (Not Me.UseThemes) Then
                renderer.ColorTable.UseSystemColors = True
            Else
                renderer.ColorTable.UseSystemColors = False
            End If
        End Sub

        <Browsable(False)> _
        Public ReadOnly Property ToolStripRenderer() As ToolStripProfessionalRenderer
            Get
                Return renderer
            End Get
        End Property

        <DefaultValue(True), Browsable(False)> _
        Public ReadOnly Property UseThemes() As Boolean
            Get
                Return ((VisualStyleRenderer.IsSupported AndAlso VisualStyleInformation.IsSupportedByOS) AndAlso Application.RenderWithVisualStyles)
            End Get
        End Property
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Arkitech EBC Corporation
United States United States
MS, BBA, software developer, consultant, and trainer. Specializing in building data-centric applications designed for business, university, community & faith based organizations. Started developing Excel VBA macros and never looked back. Freelance developer utilizing VB.Net, SQL Server, Microsoft Access, and ASP.Net.

Comments and Discussions