Hello,
I have a Form and a Class which extends Panel and inside this class, I have declared a PictureBox.
I need the MyPanel class to return the MouseEventHandler of the PictureBox, not the Panel.
The PictureBox is the same size of the Panel and therefore I cannot click the Panel underneath.
I am currently adding the MouseEvent Handler directly and keeping the PictureBox public i.e.
class MyPanel : Panel
{
public PictureBox MyImage;
public MyPanel()
{
MyImage = new PictureBox();
}
}
class MainForm : Form
{
public MyForm()
{
testpanel.MyImage.MouseDown += new MouseEventHandler(PictureBox_MouseDown);
}
public void PictureBox_MouseDown(object sender, MouseEventArgs m)
{
// Do Stuff
}
}
but I want to keep the PictureBox private and encapsulated.
How Do I do this.