How to inherit events between objects
Posted
by
marduck19
on Stack Overflow
See other posts from Stack Overflow
or by marduck19
Published on 2012-04-05T22:57:53Z
Indexed on
2012/04/05
23:29 UTC
Read the original article
Hit count: 284
I need inherit events and properties for example move a picture around the form Y have this code to move the picture but y need create multiple images with the same behavior
private void pictureBox_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
x = e.X;
y = e.Y;
}
}
private void pictureBox_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
pictureBox.Left += (e.X -x);
pictureBox.Top += (e.Y - y);
}
}
© Stack Overflow or respective owner