03-09-2007 03:43 PM
03-12-2007 06:36 PM
03-13-2007 07:40 PM
03-14-2007 03:14 PM
01-20-2011 10:17 AM
Hope my code can help people to make zooming available without any modifiers keys (alt, shift or ctrl)
private void scatterGraph1_PlotAreaMouseWheel(object sender, MouseEventArgs e)
{
if (Keyboard.Modifiers == 0) // No shift, alt or ctrl
{
double zoomFactor;
if (e.Delta > 0)
{
zoomFactor = .8; // .008 = 1/1.25, same as NI
}
else
{
zoomFactor = 1.25;
}
RectangleF rect = new RectangleF();
rect.X = (float)scatterGraph1.Plots[0].XAxis.Range.Minimum;
rect.Width = (float)(scatterGraph1.Plots[0].XAxis.Range.Maximum - scatterGraph1.XAxes[0].Range.Minimum);
rect.Y = (float)scatterGraph1.Plots[0].YAxis.Range.Minimum;
rect.Height = (float)(scatterGraph1.Plots[0].YAxis.Range.Maximum - scatterGraph1.YAxes[0].Range.Minimum);
double newWidth = rect.Width * zoomFactor;
double newHeight = rect.Height * zoomFactor;
scatterGraph1.ZoomAnimation = false;
scatterGraph1.ZoomXY(scatterGraph1.Plots[0], rect.X + ((rect.Width - newWidth) / 2), rect.Y + ((rect.Height - newHeight) / 2), newWidth, newHeight);
}
}