两个devExpress的chartControl联动
2012-12-16 19:58 hongjiumu 阅读(972) 评论(0) 编辑 收藏 举报chartControl1.RuntimeSelection = true; chartControl1.RuntimeSeriesSelectionMode = SeriesSelectionMode.Point; chartControl1.MouseClick += new MouseEventHandler(Chart_MouseClick); public void Chart_MouseClick(object sender, MouseEventArgs e) { ChartHitInfo hi = chartControl1.CalcHitInfo(new System.Drawing.Point(e.X, e.Y)); if (hi.Diagram != null) { int LeftX = -1, RightX = -1; //for (int X = chartControl1.Bounds.Left; X < chartControl1.Bounds.Right; X++) //{ // hi = chartControl1.CalcHitInfo(X, e.Y); // if (hi.InDiagram) // { // if (LeftX == -1) // LeftX = X; // else // RightX = X; // } //} XYDiagram D = chartControl1.Diagram as XYDiagram; <b>if (hi.SeriesPoint != null)</b> { //MessageBox.Show(string.Format("X:{0},Y:{1},{2}", LeftX, RightX,hi.SeriesPoint.Argument // //((chartControl1.Series.ToArray())[0].Points.ToArray())[0].Argument // )); this._vNewParam = hi.SeriesPoint.Argument; //((chartControl1.Series.ToArray())[0].Points.ToArray())[0].Argument; this.Invoke((MethodInvoker)delegate() { //TODO:string.IsNullOrEmpty if (string.IsNullOrEmpty(_vNewParam)) return; if (_vCurrentPrama == _vNewParam) return; _vCurrentPrama = _vNewParam; InitializePVC(_vCurrentPrama); }); } } }
ChartHitInfo hi = chartControl1.CalcHitInfo(new System.Drawing.Point(e.X, e.Y));
if (hi.SeriesPoint != null){}
这是关键!