Page 1 of 1

clicked in chart area?

Posted: Wed Feb 04, 2009 2:16 pm
by 14045263
Hey,

Is there an easy way (boolean, or what have you..) to check if the user clicks in the actual chart area (so the area inside all 4 axes), rather than just the chart control?

Regards,
Chris.

Posted: Wed Feb 04, 2009 2:40 pm
by yeray
Hi Chris,

The easiest way I can think is verifying in OnMouseDown event if the mouse coordinates are in the ChartRect or not. Something like this:

Code: Select all

void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            Rectangle rect = tChart1.Chart.ChartRect;
            Text = rect.Contains(new Point(e.X, e.Y)) ? "Mouse in ChartRect!" : "";
        }

Posted: Wed Feb 04, 2009 4:40 pm
by 14045263
that's exactly what I wanted, cheers Yeray