How to develop a CursorObject |
The CursorObject lets one to draw a Chart Object.
ChartObject class in turn is derived from CursorBase class which defines the various mouse and keyboard calls. Additionally the CursorObject implements the AddChartObjectT(Point) method. If user wants to add an object then he must derive his script from the CursorObject class.
The main methods of the CursorObject are as follows
OnPreviewMouseUp(MouseButtonEventArgs)
The OnMousePreviewUp method is called when the mouse left button is released.
OnPreviewMouseDown(MouseButtonEventArgs)
The OnMousePreviewDown method is called when the mouse left button is clicked. A ChartObject can be added only from this method. An sample code will be like:
protected DrawingBase DrawingBase { get; set; } protected override void OnPreviewMouseDown(MouseButtonEventArgs args) { Point point = new Point(100, 100); this.DrawingBase = base.AddChartObject<SharpCharts.Base.ChartObject.Line>(point); }
OnPreviewMouseMove(MouseEventArgs)
The OnPreviewMouseMove is called when the user moves the mouse while pressing the left mouse button.
Besides the above methods the CursorObject also have the MouseLeave MouseEnter etc methods. Please refer to the class defination to get the complete set of methods exposed by the said class