C# – Windows Mobile: how to hide Size property on a Custom Control

ccustom-controlswindows-mobile

I'm developing a Windows Mobile WinForm app with C# and .Net Compact Framework 2.0 SP2.

I have a control that inhertit from System.Windows.Form.Control that I want to make private Size property. How can I do that?

I've tried this:

new private Size;

But it doesn't compile.

Any idea?

Best Answer

Just create a public property with the same name Size in your control:

public Size Size
{
    get { return base.Size; }
    set { base.Size = value; }
}

Then you can do something in the setter to prevent your control size from being changed to a size that doesn't match your image.