Click here to Skip to main content
Click here to Skip to main content

Skinning a vertical scrollbar

, 26 Oct 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
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.

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)

Share

About the Author

MartinSon
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. PinmemberRaha2824-Jun-12 0:20 
GeneralMy vote of 5 Pinmembermanoj kumar choubey24-Feb-12 3:09 
GeneralMy vote of 5 PinmembersriramCodeProject27-Jun-11 20:34 
QuestionCan you Convert it to VB.Net 2003? Pinmemberdyh22221-Nov-06 4:46 
AnswerRe: Can you Convert it to VB.Net 2003? PinmemberMartinSon8-Nov-06 8:46 
GeneralCan you Convert it to delphi Pinmembersail20003-Jan-07 8:58 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 26 Oct 2006
Article Copyright 2006 by MartinSon
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid