Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:25:29+00:00 2026-06-14T22:25:29+00:00

In my project, I need a stand alone scroll bar for my text box.

  • 0

In my project, I need a stand alone scroll bar for my text box. So I have created a customized scroll bar. Any idea How to use my customized scroll bar(both Horizontal and Vertical) in the text box instead of built-in scroll bar?

Please find my sample code below. (In original code the textbox and the scrollbar is skinnable. I cannot post the actual code here…)

public partial class EditControl : Control
{
    int BORDERWIDTH = SystemInformation.Border3DSize.Width;
    int SCROLLBARWIDTH = SystemInformation.VerticalScrollBarWidth;
    CustomTextBox editCtrl;
    VScrollBar vScrollBar = null;
    public EditControl()
    {
        InitializeComponent();
        editCtrl = new CustomTextBox();
        this.Width = 200 + SCROLLBARWIDTH;
        this.Height = 140;

        editCtrl.Width = this.Width - SCROLLBARWIDTH;
        editCtrl.Height = this.Height;
        editCtrl.Multiline = true;
        editCtrl.Left = Left;

        vScrollBar = new VScrollBar();
        vScrollBar.Height = this.Height;
        vScrollBar.Location = new Point(editCtrl.Width, 1);
        vScrollBar.Scroll += new ScrollEventHandler(vScrollBar_Scroll);
        this.Controls.Add(editCtrl);
        this.Controls.Add(vScrollBar);
    }

    private void vScrollBar_Scroll(object sender, ScrollEventArgs e)
    {
        //Code to scroll the text box
        //editCtrl.ScrollTo(position);
    }
    protected override void OnResize(EventArgs e)
    {
        base.OnResize(e);
        editCtrl.Width = this.Width - SCROLLBARWIDTH;
        editCtrl.Height = this.Height;
    }
    public partial class CustomTextBox : TextBox
    {
        public CustomTextBox()
        {
            //InitializeComponent();
        }
        public void ScrollTo(int Position)
        {
           //Code to scroll the contents.
        } 
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:25:30+00:00Added an answer on June 14, 2026 at 10:25 pm

    The problem is solved. I have masked the original scrollbar of textbox by my customized scrollbar. GetScrollInfo API is used to synch the scrollbars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Junits I have in my project need to load property files from the
In my project I need to use third party code, stored in several Git
I need to access DB2 database in plain standalone Java project. I cannot use
The project I'm working on requires that N stand-alone applications can be built but
I already have an grails web application, And our project need CAS, however I
I have a project where I need to create a desktop app that acts
The answer: Making stand-alone jar with Simple Build Tool seems like what I need,
i have written a stand alone WCF REST service in 4.0 under Studio 2010
i need to use tools.jar in my project, but there is not much sense
I have a joomla project now currently running on.I need to add a separate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.