J
jleslie48
I made a panel and a make a plot of a data set in it. I created
mouse buttons to zoom in and out, etc and they all work fine.
I now want to make a duplicate of that panel, WITH ALL of the
programmed buttons.
when I made the cut and paste of the panel1 I got a panel2 but all my
functions were not duplicated:
////////////////////////////////////////////////////////////////////////////////////////////////
private void panel1_MouseDown(object sender,MouseEventArgs e) {
if (e.Button== MouseButtons.Left) {
md_e = mm_e = e;
draw_crosshairs = true;
panel1.Invalidate();
}//then left
else {
md_e_right =mm_e = e;
}//then right
}//panel1_mousedown
private void panel1_MouseMove(object sender,MouseEventArgs e) {
mm_e = e;
if (e.Button== MouseButtons.Left) {
draw_marker = false;
if (draw_crosshairs) {
panel1.Invalidate(); //this will force the
crosshairs to be
}//then //drawn at the mouse pointer
location.
}//then left
}//panel1_MouseMove
private void panel1_MouseUp(object sender,MouseEventArgs e) {
....
} //panel1_MouseUp
//////////////////////////////////////////////////////////////////////////////////////////////
now I know I can make a
private void panel2_MouseUp ...
private void panel2_MouseDown...
private void panel2_MouseMove...
etc cut and paste the code, and change the variables, but that
doesn't seem right.
how do I go about using a generic set of say panelx_MouseUp...
where the x is the specific panel I want (panel1, panel2,
panel3,....)
Tia,
Jon
mouse buttons to zoom in and out, etc and they all work fine.
I now want to make a duplicate of that panel, WITH ALL of the
programmed buttons.
when I made the cut and paste of the panel1 I got a panel2 but all my
functions were not duplicated:
////////////////////////////////////////////////////////////////////////////////////////////////
private void panel1_MouseDown(object sender,MouseEventArgs e) {
if (e.Button== MouseButtons.Left) {
md_e = mm_e = e;
draw_crosshairs = true;
panel1.Invalidate();
}//then left
else {
md_e_right =mm_e = e;
}//then right
}//panel1_mousedown
private void panel1_MouseMove(object sender,MouseEventArgs e) {
mm_e = e;
if (e.Button== MouseButtons.Left) {
draw_marker = false;
if (draw_crosshairs) {
panel1.Invalidate(); //this will force the
crosshairs to be
}//then //drawn at the mouse pointer
location.
}//then left
}//panel1_MouseMove
private void panel1_MouseUp(object sender,MouseEventArgs e) {
....
} //panel1_MouseUp
//////////////////////////////////////////////////////////////////////////////////////////////
now I know I can make a
private void panel2_MouseUp ...
private void panel2_MouseDown...
private void panel2_MouseMove...
etc cut and paste the code, and change the variables, but that
doesn't seem right.
how do I go about using a generic set of say panelx_MouseUp...
where the x is the specific panel I want (panel1, panel2,
panel3,....)
Tia,
Jon