views:

492

answers:

2

Hello, does anyone know how easy it is or how possible it is to skin a .net Windows Forms DataGridView control? I'd like to render the control vastly different then what it currently looks like.

For example, think of the open source application Boxee. It has a completely custom interface which is how far I'd like to push the control. I know I can possibly use WPF instead which is exactly designed for this type of usage but unfortunately I can't use .net 3.5 in the target application.

Also, if anyone knows of an open source or cheap DataGridView control that is designed for skinning please let me know. I appreciate the help.

Thank You,

-Ralph

+1  A: 

Since WinForms controls are rendered by the unmanaged user32.dll skinning them is near impossible. You'd need to re-implement the row drawing logic more or less from scratch. There are some articles which could help you if you end up implementing the Painting event and overriding the default paint behaviour: MSDN and Alex Yakhnin's Blog

Mikko Rantanen
I was able to get this working using the two links you provided. Overriding the CellPainting events solved my problem exactly however it is quite a pain because you end up with the *full* responsibility of having to redraw everything yourself from scratch. Powerful but this isn't really skinning per se.
Ralph
+1  A: 

Creating new rows and columns for the DataGridView is not that difficult. I've taken it so far as to implement progress bars and rich animations without a single hitch.

Here's an example article that started me on creating custom columns:

http://www.devx.com/codemag/Article/35186

Poke around through the properties of the DGV control, a lot of customization is already possible. It's easy to strip away most of the control generated style and then build up your own via subclassing. As long as you can accept using rectangular columns and rows in your layout it's certainly a viable option.

Robert Venables