Click here to Skip to main content
15,868,016 members
Articles / Programming Languages / Visual Basic

Skinning a vertical scrollbar

Rate me:
Please Sign up or sign in to vote.
4.36/5 (9 votes)
26 Oct 2006CPOL1 min read 64.2K   2.2K   28   6
An article on how to skin a scrollbar in a textbox or listbox with VB.NET.

Sample Image - skinScrolling.gif

Introduction

This code tries to do the same other good programmers (flyhigh, zoetrope) already have done, but with a special flavour, using VB.NET and adding two ways to get it:

  • a hand skinning method
  • a custom control in the VS palette

But remember, I say 'tries' because the code is in alpha stage.

This is only a remixing project from other sources (thanks to all CodeProject coders from whom I still steel code for fun)...

Background

I was looking for an easy skinning, free, managed solution, not C++, nor closed DLL, but the scrollbars seemed not so easy to achieve.

I recommend reading two articles: one from flyhigh posted on 6 of July 2006, and another from zoetrope about motif scrollbars.

Using the code

If you are planning to reuse or to unskin the listboxes or textboxes on the fly, then you can handwrite the code to skin your already created and positioned controls. Include a new variable of type scrollSkin, and in the New() function of the main form, associate this ListBox with the constructor. Don't forget to add it to the Me form.

VB
Friend WithEvents noDesignerCtl  As IPEuropa.scrollSkin

Sub New()

    ' This call is required by the Windows Form Designer.
    InitializeComponent()

    '
    'UserControls manual skinning  
    '
    Me.ResumeLayout(False)
    Me.noDesignerCtl  = New IPEuropa.scrollSkin(Me.ListBox1)

    Me.noDesignerCtl .TabIndex = 0

    Me.Controls.Add(Me.noDesignerCtl 
    Me.ResumeLayout(True)
    Me.PerformLayout()

End Sub

If you prefer to drag and drop from the control's palette a customScroll for each ListBox or TextBox, this customScroll is a Panel, so you have to put into it a TextBox or a ListBox control, docked in Fill mode and resize it to fit the vertical scrollbar.

History

  • Very first version: 15 October, 2006.

License

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


Written By
Web Developer
Spain Spain
Born in Valencia (Spain). Agricultural engineer, informatics engineer.
Keen on drinking wine & beer and travelling.(original isn't it)
Actually teaching in high-school an wasting a significative part of my life in programming with the .NET.

Comments and Discussions

 
QuestionShow the slider when a image is clicked. Pin
Raha2823-Jun-12 23:20
Raha2823-Jun-12 23:20 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey24-Feb-12 2:09
professionalManoj Kumar Choubey24-Feb-12 2:09 
GeneralMy vote of 5 Pin
sriramCodeProject27-Jun-11 19:34
sriramCodeProject27-Jun-11 19:34 
QuestionCan you Convert it to VB.Net 2003? Pin
dyh22221-Nov-06 3:46
dyh22221-Nov-06 3:46 
AnswerRe: Can you Convert it to VB.Net 2003? Pin
MartinSon8-Nov-06 7:46
MartinSon8-Nov-06 7:46 
GeneralCan you Convert it to delphi Pin
sail20003-Jan-07 7:58
sail20003-Jan-07 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.