3 Answers, 1 is accepted
0

Klemens
Top achievements
Rank 1
answered on 30 Oct 2013, 06:50 AM
Hi,
now I have this:
When I press the middle mouse button the chart is successfully panning. But when I release it there is also a zoom. Why?
Regards Markus
now I have this:
private
const
UInt32 MouseEventLeftDown = 0x0002;
private
const
UInt32 MouseEventLeftUp = 0x0004;
[DllImport(
"user32"
, EntryPoint =
"mouse_event"
)]
private
static
extern
void
mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, UInt32 dwExtraInfo);
private
void
chartView_MouseDown(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
if
(e.ChangedButton == System.Windows.Input.MouseButton.Middle)
{
PanAndZoom.DragMode = ChartDragMode.Pan;
mouse_event(MouseEventLeftDown, 0, 0, 0, 0);
}
}
private
void
chartView_MouseUp(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
if
(e.ChangedButton == System.Windows.Input.MouseButton.Middle)
{
mouse_event(MouseEventLeftUp, 0, 0, 0, 0);
PanAndZoom.DragMode = ChartDragMode.Zoom;
}
}
When I press the middle mouse button the chart is successfully panning. But when I release it there is also a zoom. Why?
Regards Markus
0
Hello Markus,
The most likely reason for this is that the mouse wheel is rotated and the MouseWheel event is raised, which in turn zooms the chart in and out. You can change this by setting the MouseWheelMode property of the ChartPanAndZoomBehavior.
Regards,
Petar Marchev
Telerik
The most likely reason for this is that the mouse wheel is rotated and the MouseWheel event is raised, which in turn zooms the chart in and out. You can change this by setting the MouseWheelMode property of the ChartPanAndZoomBehavior.
Regards,
Petar Marchev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0

Klemens
Top achievements
Rank 1
answered on 30 Oct 2013, 12:34 PM
Hi,
I noticed that when I release the button, the zoom mode is activated for a bit. So I'm zooming in. Workaround for this is:
With the ReleaseCapture set, there is no zooming.
Regards Markus
I noticed that when I release the button, the zoom mode is activated for a bit. So I'm zooming in. Workaround for this is:
[DllImport(
"user32.dll"
)]
public
static
extern
bool
ReleaseCapture();
private
void
chartView_MouseUp(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
if
(e.ChangedButton == System.Windows.Input.MouseButton.Middle)
{
mouse_event(MouseEventLeftUp, 0, 0, 0, 0);
PanAndZoom.DragMode = ChartDragMode.Zoom;
ReleaseCapture();
}
}
With the ReleaseCapture set, there is no zooming.
Regards Markus