|
-
November 8th, 2011, 01:31 AM
#1
Using a derived class
I'm kind of new to C#. I want to use the class below that modifies ListView so that it doesn't flicker. Normally I would just drag over the listview control from the toolbox, edit the properties and modify the events. How would I use the below code to replace the standard ListView? Can someone give me a step by step on how to use this in place of the standard listview control?
class ListViewNF : System.Windows.Forms.ListView
{
public ListViewNF()
{
//Activate double buffering
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
//Enable the OnNotifyMessage event so we get a chance to filter out
// Windows messages before they get to the form's WndProc
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
}
protected override void OnNotifyMessage(Message m)
{
//Filter out the WM_ERASEBKGND message
if(m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|