Background:
When using C1Maps for WinForms, by default the left mouse button performs two operations: the selection of objects and panning of the map. A developer might want to split the functionality, so that the left mouse button click only selects map objects and the panning of the map is performed by pressing the mouse wheel.
This article shows how to make the mouse wheel perform panning upon press.
Steps to Complete:
To split the functionality, the developer can replace the mouse events by creating a custom class that implements C1.Win.Map.C1Map and override the OnMouseDown and OnMouseMove events, as follows:
-----------------
Public Class CustomC1Map
Inherits C1.Win.Map.C1Map
Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
If e.Button.HasFlag(MouseButtons.Middle) Then
MyBase.OnMouseDown(New MouseEventArgs(MouseButtons.Left, e.Clicks, e.X, e.Y, e.Delta))
Else
MyBase.OnMouseDown(e)
End If
End Sub
Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
If Not e.Button.HasFlag(MouseButtons.Left) Then
MyBase.OnMouseMove(e)
End If
End Sub
End Class
-----------------
With the above code, left mouse button click will select map objects and pressing the mouse wheel will pan the map.
Ruchir Agarwal