
Standard Scrollbar (HELP) ...
Hello Athos,
I am afraid there is not an easy way to customize a ScrollBar control
provided by .NET Framework. You may derive a new class from the ScrollBar,
and draw all things by yourself in the OnPaint method. Two things should
pay attention to:
1. You should set the Control's UserPaint style to true to enable the
UserPaint
2. You should draw all items in the method, event you call the base's
OnPaint method.
This is a sample code:
public class MyScrollBar : System.Windows.Forms.HScrollBar
{
public MyScrollBar()
{
this.SetStyle(ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
//Perform your drawing here
e.Graphics.DrawLine(Pens.Red,0,0,100,100);
base.OnPaint(e);
}
Quote:
}
I hope it is helpful.
Best regards,
Lion Shi, MCSE, MCSD
Microsoft Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
Subject: Standard Scrollbar (HELP) ...
Date: Sat, 13 Jul 2002 20:10:27 +0200
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Newsgroups: microsoft.public.dotnet.languages.CSharp
NNTP-Posting-Host: 195.215.252.161
Path: cpmsftngxa07!tkmsftngp01!tkmsftngp08
Xref: cpmsftngxa07 microsoft.public.dotnet.languages.csharp:75500
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Hi,
Is it possible to change the graphics in a standard ScrollBar (that
is :
changing its appearance) ?
tia,
- Athos.