Redraw the scroll bar in the WinForm and control the scroll of the listbox with the redrawn scroll bar

Source: Internet
Author: User
Tags resource

In my previous essay << high imitation Qqmusic player, talking about the production >> of WinForm about the UI, I am extremely dissatisfied with the gray scroll bar on the right side of the player list, and also affect the coordination of the whole software UI, I was determined to redraw a scroll bar that matched your UI style.

Search a lot of information, can not find a direct rewrite of the ListBox scroll bar method, can only curve the nation, first redraw a skin with the scroll bar, and then let it replace the existing scroll bar listbox.

Old habits, first pass an effect chart, you feel interested to continue to see, do not like the words to stop, lazy to delay your treasure

Expensive time, hehe.

Note that the scroll bar width in this figure is significantly less than the width of the listbox itself, and I am currently focusing on the implementation of the function, after all, the width of the adjustment is quite simple ah.

The following is a brief introduction to the detailed steps for redrawing the system scroll bar:

1. Add New item in Project--user control, we named CustomScrollbar.cs

2. To prepare a few pictures to add to the project resource as a scroll bar redraw the background, I use the following picture:

Uparrow.png Resource Name is UpArrow, scroll bar up ARROW

Thumbbottom.png Resource Name is Thumbbottom, the background of the scroll bar middle slide

Thumbmiddle.png Resource Name is Thumbmiddle, drag block in middle of scroll bar

Downarrow.png Resource Name is DownArrow, scroll bar down arrow

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.