C # beautify the winform listview Control

Source: Internet
Author: User

First look at the effect:
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

. Net built-in listview control itself has some bugs, for example, when you set the display mode to tile (tile) style, select different items, some selected backgrounds are not completely refreshed, and some focus boxes are left. During the beautification process, I tried my best to pay attention to these problems, but I did not perform too many tests. There may also be some problems, first, let's talk about the implemented and unimplemented functions.

Implemented functions:

1. Change the border color.

2. When the display mode is details and list, different background colors are displayed for the separated items.

3. When the display mode is details, beautify the list header.

4. Background beautification after selecting items of various display styles (largeicon, smallicon, list, tile, and details.

Features not implemented:

1. checkbox cannot be displayed. This cannot be drawn. The problem is that the position displayed in the checkbox cannot be obtained, because only the default position of the checkbox is clicked, and that item will be selected, if the checkbox you have drawn is not the same as the default position, it is useless to click it. Therefore, checkbox is not supported.

You can use the getbounds method to obtain the position and size of the icon and text, that is, the checkbox is not obtained. It is easier to draw the largeicon, smallicon, and list display styles. To draw the details style, you must note that the background is drawn when the fullrowselect settings are different. tile style text is easier to draw, the position and size of each subitem text must be calculated separately. It is very easy to draw an icon if it is not selected. To achieve the effect that comes with the system, you need to use the API function: imagelist_geticon. The specific method is as follows, let's take a look at all the drawing code :......

 

 

For the complete article, see "listview (4) of the C # winform control beautification extension series-beautifying all styles".

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.