Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » Applications » Downloads
 
Add your own
alternative version

VB 9.0, C# 3.0 API Viewer

, 24 May 2012 CPOL
This is a remake of Pramod Kumar Sing's 2002 API Viewer.
VSAPIVIEWER.zip
APIViewer12
APIViewer12
APIViewer12.sln.docstates.suo
APIViewer12.suo
APIviewer.ICO
APIViewer12.vbproj.user
bin
Debug
API
APIViewer12.exe
APIViewer12.pdb
APIViewer12.vshost.exe
APIViewer12.vshost.exe.manifest
GlassButtonVB.dll
Release
My Project
Application.myapp
Settings.settings
obj
x86
Debug
APIViewer12.exe
APIViewer12.FormSplash.resources
APIViewer12.frmAbout.resources
APIViewer12.frmViewer.resources
APIViewer12.pdb
APIViewer12.Resources.resources
APIViewer12.vbproj.GenerateResource.Cache
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
My Project.Resources.Designer.vb.dll
Release
Resources
arrow_in.png
arrow_left.png
arrow_out.png
arrow_right.png
backgroundGradient_BOB-1.png
Fullscreen.png
OilcanHarry.jpg

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Namespace CustomControls
    ''' <summary>
    ''' The labeled divider provides a Aero styled divider with an option caption, similiar to what is seen in the
    ''' Control Panel dialogs of Windows 7 and Vista.
    ''' </summary>
    Public Class DividerControl
        Inherits Control

        Public Sub New()
            SetStyle(ControlStyles.AllPaintingInWmPaint Or _
                ControlStyles.DoubleBuffer Or _
                ControlStyles.ResizeRedraw Or _
                ControlStyles.SupportsTransparentBackColor Or _
                ControlStyles.UserPaint, True)

            Me.Font = New Font("Tahoma", 9, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me._text = Me.Name
            Me.ForeColor = Color.Gray
            Me.Width = 200
        End Sub

        Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            MyBase.OnPaint(e)

            Dim sbDividerColor As New SolidBrush(Me._dividerColor)
            Dim sbForeColor As New SolidBrush(Me.ForeColor)

            ' Draw the caption string, then get the size of it as it appears on the screen so
            ' we know where to put the caption.
            e.Graphics.DrawString(Me.Text, Me.Font, sbForeColor, 0, 0)
            Dim sf As SizeF = e.Graphics.MeasureString(Me.Text, Me.Font)

            ' This didn't quiet get in the center so I had to add 1 pixel to the sf.Height / 2

            Dim rect As New Rectangle(CInt(sf.Width), CInt((sf.Height) / 2) + 1, Me.Width - CInt(sf.Width), 1)
            e.Graphics.FillRectangle(sbDividerColor, rect)

            sbForeColor.Dispose()
            sbDividerColor.Dispose()
        End Sub

        Private _dividerColor As Color = Color.FromArgb(176, 191, 222)
        ''' <summary>
        ''' The color of the divider line.
        ''' </summary>
        <Description("The color of the divider line."), Category("Appearance")> _
        Public Property DividerColor() As Color
            Get
                Return Me._dividerColor
            End Get
            Set(ByVal value As Color)
                Me._dividerColor = value
            End Set
        End Property

        Private _text As String = ""
        ''' <summary>
        ''' The text that should be used for the caption.  If the caption is set to blank and the divider position is set to center then
        ''' a simple divider line will be drawn.
        ''' </summary>
        ''' <remarks>
        ''' After a change is made to the text property we want to invalidate the control so it triggers a new paint message being sent.
        ''' </remarks>
        <Description("The text that will display as the caption."), Category("Appearance"), DefaultValue("DividerLabel")> _
        Public Overloads Overrides Property Text() As String
            Get
                Return Me._text
            End Get
            Set(ByVal value As String)
                Me._text = value
                Me.Invalidate()
            End Set
        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)

Share

About the Author

rspercy65
Retired
United States United States
I am currently retired.
I have no degree but I have some programming experience
when I was in college(Cobol, Pascal).
 
My accomplishments thus far are;
Best VB.Net article for January(2009)
Best VB.Net article for July(2009)

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 24 May 2012
Article Copyright 2010 by rspercy65
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid