Hi, I inherited the listview control in a custom control. And added the following override:

Code Block

protected override void OnPaint(PaintEventArgs e)
DrawGradient(e.Graphics, Color.Blue, Color.White, this.ClientRectangle);


But the OnPaint event is not fired at all... am I forgetting something

Re: .NET Compact Framework Inheriting listview

Chunsheng Tang - MSFT

Hi, Mark

Yes, it is never fired for it is not used in ListView at all. Have you noticed that there is no paint event of the ListView. Customizing the appearance of the ListView is quite limited. I am afraid you have to begin with the Control class.

Best Regards
Chunsheng Tang

Re: .NET Compact Framework Inheriting listview


You can hook the underlying WM_PAINT message and do with it what you want. It likely won't be easy, though.

See this article for more information: "Subclassing controls in .NETCF 2.0"

part 1:

part 2: