c#MS图表获取滚动条值

时间:2014-11-17 10:04:55

标签: c# scrollbar mschart

可以从缩放图表中获取X滚动条的值吗?有人可以帮帮我吗?在Datagrdiview中,我使用dataGridView1.FirstDisplayedCell.RowIndex;

来处理它

1 个答案:

答案 0 :(得分:0)

几天几夜后我找到了解决方案。我之前使用过这些功能,但我无法连接它们。此解决方案显示哪个点数显示为收集的第一个和终点数。

private void chart1_AxisViewChanged(object sender, ViewEventArgs e)
    {
        if (!allowReadData)
            allowReadData = true;
    }

private void timer4_Tick(object sender, EventArgs e)
    {
        if (allowReadData && MouseButtons != MouseButtons.Left)
        {
            allowReadData = false;
            double xMin = chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
            double xMax = chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
            MessageBox.Show("Minimum: " + xMin+"\nMaximum: "+xMax);
        }
    }