私はそれを理解しました。 GraphPane.FindNearestObject
を使用して、クリックされたポイントを見つけることができます。
あなたのポイントをクリックしないとnearestObject
がnull
ているようだし、あなたがしなければタイプLineItem
のものであり、その後、index
がクリックされたポイントを教えてくれます。
private void zedGraphControl_MouseClick(object sender, MouseEventArgs e)
{
object nearestObject;
int index;
this.zedGraphControl.GraphPane.FindNearestObject(new PointF(e.X, e.Y), this.CreateGraphics(), out nearestObject, out index);
if (nearestObject != null && nearestObject.GetType() == typeof(LineItem))
{
// 'index' is the index of that data point
dataGridView.CurrentCell = dataGridView.Rows[index].Cells[0];
}
}
ZedGraphに精通していません。 MSChartでは、MouseclickイベントでHitTestを実行します。 – TaW