Standard Scrollbar (HELP) ... 
Author Message
 Standard Scrollbar (HELP) ...

Hi,
   Is it possible to change the graphics in a standard ScrollBar (that is :
changing its appearance) ?

tia,

                                - Athos.



Thu, 30 Dec 2004 02:10:27 GMT  
 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.



Sat, 01 Jan 2005 13:59:19 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Horizontal Scrollbar Controls in VC++6 (Standard, Academic)

2. Show standard scrollbar of a window.

3. ClistCtrl ScrollBar and ScrollBar range

4. Help about ScrollBar

5. Help on writing scrollbar control please

6. HELP: Scrollbar in a Dialog

7. Please help me about Scrollbar

8. Please help me about ScrollBar

9. Scrollbar position help

10. help with scrollbar control

11. Help: Left-Aligned Scrollbar in CScrolView?

12. Standard C using Standard C

 

 
Powered by phpBB® Forum Software