我要放大圖表「System.EventArgs」不包含定義「位置」
private void toolStripButtonZoom_Click(object sender, System.EventArgs e)
{
double posXStart = chartMain.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) - (xMax - xMin)/0.5;
double posXFinish = chartMain.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) + (xMax - xMin)/0.5;
double posYStart = chartMain.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y) - (yMax - yMin)/0.5;
double posYFinish = chartMain.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y) + (yMax - yMin)/0.5;
chartMain.ChartAreas[0].AxisX.ScaleView.Zoom(posXStart, posXFinish);
chartMain.ChartAreas[0].AxisY.ScaleView.Zoom(posYStart, posYFinish);
}
它不承認「位置」,並給出了這個錯誤。
在哪個活動你有這個代碼? – Steve
錯誤是相當自我解釋的。 'e'的類型是'EventArgs',它沒有一個名爲'Location'的屬性。您可能會附上錯誤的事件。 – CodingIntrigue
您可以發佈該功能的簽名'public void OnZoom(EventAgrs e)'包含您在.cs文件中使用的任何命名空間?基本上,您在該方法中使用的EventArgs類型不包含名爲'Location'的屬性,這意味着正在使用錯誤的類型。 –