EasyGIS.NET
EasyGIS.NET copied to clipboard
Removing Keys CTRL and Shift from SFmap Internal Panning Scenarios
For editing purposes, I use pressed CTRL or Shift Key respectively to achieve bespoke functionality SFmap object uses both Keys to Show the Selection rectangle/circle. Is there a way to disable drawing Selection rectangle/circle in pan mode while CTRL or Shift Key is pressed? I use the left and right mouse buttons to pan a map. If my selection mode or drawing mode is pending then only the right mouse bottom performs panning. If the left mouse is pressed in either mode panning mode is set to None. I managed to bring the SFmap object to an internal state where the SFmap selection rectangle was showing without CTRL or Shift Key pressed. Unfortunately, I did not press and release either CRTL or Shift to potentially bring the internal SFmap to the correct state.
If you want to disable the Control or Shift selection feature you can try setting your MainForm KeyPreview to true and then add a KeyDown event to the main form to detect the key press and cancel the event.
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control || e.Shift) e.Handled = true;
}
Thanks for that, however, I do use the Shift and Control key in my scenarios a lot. Just removing them as suggested would disable to access than when I need them. For example, if the user wants to draw the next polyline point while Shift is pressed and the cursor is close enough to another object (or the one he is just creating), GUI points to the position on a polyline that is closest to the cursor. Like a perfect snap to the polyline. In general, I expose this and similar functionalities when no mouse button is pressed. So would need to check if adding the mouse button condition to the above suggestion would save the day.
I have successfully included a circle and a rectangle into my code without disruption. No selection is made just info about distance. It would be great to include the following while drawing circle/rectangle.
- the red label should have a white border to optimize visibility.
Two SFmap properties:
- DistanceMultipyFactor as single
- DisatnceUnit as string
This would enable to show distance in any value/unit user might need :-)