In WindowsForms.
I have a custom control that contains only one control: a PictureBox.
public partial class VarIllumButton : UserControl
It uses the OnLoad method:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e); // Handle the default function
pictureBox.Image = image0;
}
Since the custom control only has 1 control, I wish to change it to:
public partial class VarIllumButton : PictureBox
But then I get an error
'System.Windows.Forms.PictureBox' does not contain a definition for 'OnLoad'
Yet, I see that the Control class does have an OnLoad method:
Can you think of why I can access it from a UserControl, but not from a Control?
Is there another method that I can use that is called when the Control finishes loading?