Skinning a vertical scrollbar
An article on how to skin a scrollbar in a textbox or listbox with VB.NET.
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.
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.