internal void SetDataCursor() { try { m_objDataCursor = new DataCursor(m_objChartView, m_objCartesianCordinates, GraphObj.MARKER_VLINE, 8.0); m_objDataCursor.SetColor(Color.Black); m_objDataCursor.SetEnable(true); m_objDataCursor.LineStyle = DashStyle.Solid; m_objDataCursor.SetLineStyle(DashStyle.Solid); m_objDataCursor.LineColor = Color.Black; m_objChartView.SetCurrentMouseListener(m_objDataCursor); m_objChartView.AddChartObject(m_objDataCursor); if (m_objMarker != null) { m_objChartView.DeleteChartObject(m_objMarker); m_objChartView.UpdateDraw(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message, ex.StackTrace); } finally { } }
void m_obj3DGraphControl_GraphClicked(System.Windows.Forms.MouseEventArgs e) { Point3D objPoint = null; Point2D obj2DPoint = null; double dImplicitZValue = 0; try { obj2DPoint = new Point2D(e.X, e.Y); double dZValue = obj2DPoint.GetZ(); objPoint = new Point3D(e.X, e.Y, dZValue); m_objClickedPlot = (SimpleLinePlot)m_objChartView.FindObj(objPoint, "SimpleLinePlot"); if (m_objClickedPlot != null && m_objClickedPlot.LineWidth == 0.5) { m_objClickedPlot.SetLineWidth(1.5); m_objMainGraphControl.LabelColor = m_objClickedPlot.GetColor(); } if (m_objPreviousLinePlot != null && m_objPreviousLinePlot.DisplayDataset != m_objClickedPlot.DisplayDataset && m_objPreviousLinePlot.LineWidth == 1.5) { m_objPreviousLinePlot.SetLineWidth(0.5); } dImplicitZValue = m_objClickedPlot.DisplayDataset.ImplicitZValue; Point3D objLocationPoint = null; NearestPointData objNearestPoint = null; Point3D objGetPoint = null; if (e.Button == MouseButtons.Left) { if (m_objDataCursor != null) { objNearestPoint = new NearestPointData(); objLocationPoint = m_objDataCursor.Location; m_objDataCursor.SetColor(Color.Transparent); m_objDataCursor.SetLocation(objLocationPoint); if (m_objClickedPlot != null) { bFirstPlot = m_objClickedPlot.CalcNearestPoint(objLocationPoint, 3, objNearestPoint); objGetPoint = objNearestPoint.GetNearestPoint(); if (m_objMarker != null) { m_objChartView.DeleteChartObject(m_objMarker); m_objChartView.DeleteChartObject(m_objDataCursor); } m_objMarker = new Marker(m_objCartesianCordinates, GraphObj.MARKER_BOX, objLocationPoint.GetX(), objLocationPoint.GetY(), objLocationPoint.GetZ(), 8, 1); m_objMarker.FillColor = Color.Black; m_objMarker.SetColor(Color.Black); m_objChartView.AddChartObject(m_objMarker); string sDisplaytext = "X Value:" + objLocationPoint.GetX() + "\n" + "Y Value:" + objLocationPoint.GetY(); m_obj3DGraphControl.SetLabelText(sDisplaytext); } } } m_objChartView.UpdateDraw(); m_objPreviousLinePlot = m_objClickedPlot; m_objPreviousColor = m_objClickedPlot.GetColor(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message, ex.StackTrace); } }