views:

2230

answers:

2
+4  Q: 

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.

+1  A: 

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.

Mitchel Sellers
+2  A: 

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.

Nick