I have a custom listbox that inherits the WinForms ListBox class, like so.
public class UserListBox : ListBox
{
protected override void OnPaint(PaintEventArgs e)
{
// Omitted for brevity...
}
}
I add a filter on this ListBox (just like GridView control's DefaultView) but when I change the items, the OnPaint method is called regardless. I cannot call other method like remove.
I test SendMessage WM_SETREDRAW to suspend update, but that isn't working.
How can I suspend the call to the OnPaint method?