Click here to Skip to main content
15,886,518 members
Articles / Multimedia / GDI+

Cool Scrollbar - Scrollbar like Windows Media Player's

Rate me:
Please Sign up or sign in to vote.
4.15/5 (28 votes)
3 May 2005CPOL6 min read 259.2K   2.8K   47  
A cool scrollbar control.
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows ������������ɵĴ��� "

    Public Sub New()
        MyBase.New()

        '�õ����� Windows ���������������ġ�
        InitializeComponent()

        '�� InitializeComponent() ����֮������κγ�ʼ��

    End Sub

    '������д dispose ����������б��
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows ����������������
    Private components As System.ComponentModel.IContainer

    'ע��: ���¹����� Windows ����������������
    '����ʹ�� Windows ����������޸Ĵ˹��̡�
    '��Ҫʹ�ô���༭���޸�����
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents CBar1 As cbar.CBar
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents CBar2 As cbar.CBar
    Friend WithEvents CBar3 As cbar.CBar
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.Label1 = New System.Windows.Forms.Label
        Me.CBar1 = New cbar.CBar
        Me.Label2 = New System.Windows.Forms.Label
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.CBar3 = New cbar.CBar
        Me.CBar2 = New cbar.CBar
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(184, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 24)
        Me.Label1.TabIndex = 2
        '
        'CBar1
        '
        Me.CBar1.Cursor = System.Windows.Forms.Cursors.Hand
        Me.CBar1.LargeChange = CType(3, Long)
        Me.CBar1.LeftArrow = CType(resources.GetObject("CBar1.LeftArrow"), System.Drawing.Bitmap)
        Me.CBar1.LeftChannelBeginColor = System.Drawing.Color.Green
        Me.CBar1.LeftChannelEndColor = System.Drawing.Color.White
        Me.CBar1.Location = New System.Drawing.Point(56, 40)
        Me.CBar1.MaxValue = CType(50, Long)
        Me.CBar1.MinValue = CType(-50, Long)
        Me.CBar1.Name = "CBar1"
        Me.CBar1.RightArrow = CType(resources.GetObject("CBar1.RightArrow"), System.Drawing.Bitmap)
        Me.CBar1.RightChannelBeginColor = System.Drawing.Color.Honeydew
        Me.CBar1.RightChannelEndColor = System.Drawing.Color.Gray
        Me.CBar1.ScrollbarLayout = cbar.CBar.BarLayout.Vertical
        Me.CBar1.Size = New System.Drawing.Size(14, 272)
        Me.CBar1.TabIndex = 3
        Me.CBar1.ThumbFillColor = System.Drawing.Color.DarkRed
        Me.CBar1.ThumbRectColor = System.Drawing.Color.Azure
        Me.CBar1.TrackBorderColor = System.Drawing.Color.Gold
        Me.CBar1.Value = CType(20, Long)
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(88, 40)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(91, 17)
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "Current Value:"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.CBar3)
        Me.GroupBox1.Controls.Add(Me.CBar2)
        Me.GroupBox1.Location = New System.Drawing.Point(128, 240)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(424, 80)
        Me.GroupBox1.TabIndex = 5
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "More Colors:"
        '
        'CBar3
        '
        Me.CBar3.Cursor = System.Windows.Forms.Cursors.Hand
        Me.CBar3.LargeChange = CType(10, Long)
        Me.CBar3.LeftArrow = CType(resources.GetObject("CBar3.LeftArrow"), System.Drawing.Bitmap)
        Me.CBar3.LeftChannelBeginColor = System.Drawing.Color.Red
        Me.CBar3.LeftChannelEndColor = System.Drawing.Color.Snow
        Me.CBar3.Location = New System.Drawing.Point(8, 48)
        Me.CBar3.MaxValue = CType(100, Long)
        Me.CBar3.MinValue = CType(0, Long)
        Me.CBar3.Name = "CBar3"
        Me.CBar3.RightArrow = CType(resources.GetObject("CBar3.RightArrow"), System.Drawing.Bitmap)
        Me.CBar3.RightChannelBeginColor = System.Drawing.Color.LemonChiffon
        Me.CBar3.RightChannelEndColor = System.Drawing.Color.White
        Me.CBar3.ScrollbarLayout = cbar.CBar.BarLayout.Horizontal
        Me.CBar3.Size = New System.Drawing.Size(392, 14)
        Me.CBar3.TabIndex = 1
        Me.CBar3.ThumbFillColor = System.Drawing.Color.Black
        Me.CBar3.ThumbRectColor = System.Drawing.Color.Silver
        Me.CBar3.TrackBorderColor = System.Drawing.Color.DeepSkyBlue
        Me.CBar3.Value = CType(20, Long)
        '
        'CBar2
        '
        Me.CBar2.Cursor = System.Windows.Forms.Cursors.Hand
        Me.CBar2.LargeChange = CType(10, Long)
        Me.CBar2.LeftArrow = CType(resources.GetObject("CBar2.LeftArrow"), System.Drawing.Bitmap)
        Me.CBar2.LeftChannelBeginColor = System.Drawing.Color.Navy
        Me.CBar2.LeftChannelEndColor = System.Drawing.Color.PaleTurquoise
        Me.CBar2.Location = New System.Drawing.Point(8, 24)
        Me.CBar2.MaxValue = CType(100, Long)
        Me.CBar2.MinValue = CType(0, Long)
        Me.CBar2.Name = "CBar2"
        Me.CBar2.RightArrow = CType(resources.GetObject("CBar2.RightArrow"), System.Drawing.Bitmap)
        Me.CBar2.RightChannelBeginColor = System.Drawing.Color.Red
        Me.CBar2.RightChannelEndColor = System.Drawing.Color.White
        Me.CBar2.ScrollbarLayout = cbar.CBar.BarLayout.Horizontal
        Me.CBar2.Size = New System.Drawing.Size(392, 14)
        Me.CBar2.TabIndex = 0
        Me.CBar2.ThumbFillColor = System.Drawing.Color.Blue
        Me.CBar2.ThumbRectColor = System.Drawing.Color.LightYellow
        Me.CBar2.TrackBorderColor = System.Drawing.Color.Black
        Me.CBar2.Value = CType(72, Long)
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.Color.White
        Me.ClientSize = New System.Drawing.Size(672, 405)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.CBar1)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "Cool Scrollbar Test"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub CBar1_ValueChanged() Handles CBar1.ValueChanged
        Label1.Text = CBar1.Value
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        CBar1.ScrollbarLayout = cbar.CBar.BarLayout.Vertical
    End Sub
End Class

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
Web Developer
United States United States
Graduated from Wuhan University(EE), China in june 2004, I worked for Fiberhome Telecommunication Technologies, Co., LTD, WRI for one year, and now I am pursuing my graduate studies in Electrical Engineering. Basicly I wrote programs in my spare time.

Comments and Discussions