0

I am trying to make appear the ZoomRectangle (fixed size and following mouse) after a button click event, but I couldn't find anything at the documentation.

Any ideas?

    OxyRect lens;
    private void button2_Click(object sender, EventArgs e)
    {
        lens = new OxyRect(0, 0, tempPlot.Width / 4, tempPlot.Height / 4);
        tempPlot.ShowZoomRectangle(lens);
        tempPlot.MouseMove += new System.Windows.Forms.MouseEventHandler(this.plot_MouseMove);
    }

    private void panelTemp_MouseMove(object sender, MouseEventArgs e)
    {
        lens.Left = e.X;
        lens.Top = e.Y;
    }

1 Answers1

4

Sorry, I don't have enough reputation to put this in the form of a comment.

Just to let you know OxyPlot already has the functionality to zoom in on a specific area. Just hold middle mouse click and drag it over the area you want to zoom in on.

If that's not what you're after and you do want your zoom rectangle, you can create an event which reduces the current X and Y axis by a set amount using the mouse location.

The mouse location can be got from the PlotView from mouse events and from there InversedTransformation can be used to get the plot co-ordinates.

Hope this helps!

RagedMilkMan
  • 425
  • 5
  • 16