MarkXNA

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

Code Block

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaintBackground(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

timg_msft

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: http://blogs.msdn.com/netcfteam/archive/2005/05/20/420551.aspx

part 2: http://blogs.msdn.com/netcfteam/archive/2005/05/23/421143.aspx