How to Get the Nearest Grid Point on a Diagram
The GetNearestGridPoint method can be used to get the nearest grid point on a diagram based on a given point.
This method has the following two parameters:
- Point - specifies the location which calculates the nearest grid point.
- Int - specifies the ruler height.
The following code snippet illustrates the implementation of GetNearestGridPoint method:
//Current mouse position Point ptMouse = new Point(e.X, e.Y); int rulerHeight = (diagram1.ShowRulers) ? diagram1.RulersHeight : 0; //Nearest grid point PointF ptGridNearestPoint = diagram1.View.Grid.GetNearestGridPoint(ptMouse, rulerHeight);
Current mouse position Dim ptMouse As Point = New Point (e.X, e.Y) Dim rulerHeight As Integer rulerHeight = If((diagram1.ShowRulers), diagram1.RulersHeight, 0) 'Nearest grid point Dim ptGridNearestPoint As PointF = diagram1.View.Grid.GetNearestGridPoint(ptMouse, rulerHeight)
Was this page helpful? Yes No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page