Posted 28 October 2022, 5:47 am EST
How can I draw a rectangle with the mouse?
Regards
Forums Home / ComponentOne / WinForms Edition
Posted by: cnoelle on 28 October 2022, 5:47 am EST
Posted 28 October 2022, 5:47 am EST
How can I draw a rectangle with the mouse?
Regards
Posted 1 November 2022, 1:50 pm EST
Hi,
You can extend the C1Map and override the OnMouseDown, OnMouseMove, and OnMouseUp events to detect dragging and the initial and final point. Then in MouseUp, you can add a VectorPolygon according to the points.
Please refer to the sample attached that adds a rectangle to the Map if you drag Mouse while holding the Control key.
Regards
Avnish
Posted 6 November 2022, 5:36 pm EST
Thanks, this is the straightforward way.
I added a rubberbox for better targeting.
Regards,
Chris