user3390902
user3390902

Reputation:

WndProc no suitable method found to override

I am creating a custom user control and i am trying to call WndProc in that control. But, it gives me error WndProc: no suitable method found to override.

public partial class MyControl : UserControl, ICloneable, IComparable<MyControl>
{
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
    protected override IntPtr WndProc(System.Windows.Forms.Message m)
    {
        SOME CODES
    }
}

How to override this method in my usercontrol? Is it related to partial modifier?

Upvotes: 0

Views: 2690

Answers (2)

ptt
ptt

Reputation: 111

Just add full variable type for the Messsage m (System.Windows.Forms.Message) and pass byref:

protected override void WndProc(ref System.Windows.Forms.Message m)

Upvotes: 0

DarkSquirrel42
DarkSquirrel42

Reputation: 10257

the signature is:

protected virtual void WndProc(ref Message m)

Upvotes: 3

Related Questions