简体   繁体   中英

C# Custom ListView

Does anyone have any info on creating/drawing a customised ListView object?

Currently Im working on a project that requires a customised look and feel within the application. I am using a standard (Windows.Forms) ListView which is not in the same style as the rest of the GUI. We are NOT using a toolbox for custom controls, all controlls are 'skinned' inhouse as it were by overriding hte OnPaint() method for each control.

What Im looking for is: - Information about how to handle drawing of the Scroll Bar. - How to use customised drawing routines to handle the column headers. - How to still handle the data shown and draw that correctly.

Any and all help would be greatly received.

Subclass ListBox . In the ctor, set the draw mode to OwnerDrawVariable and override OnDrawItem and OnMeasureItem . I like to have a special Item class which allows the user to specify any custom drawing for that item as well as an object which will be the data.

From what I can tell you will need to actually make some Win32 calls using NM_CUSTOMDRAW to actually change the paint behavior of the control Here is one article I found. You are going to have to do a bit more digging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM