zoomselection

Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.

Moderator: Alex

Post Reply
MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

zoomselection

Post by MichaelHerrmanns » Mon Feb 20, 2012 12:54 pm

Hello,

I want to use to zoomselection feature.
If an user doubleclick on the image a rectangle with mousepoint as centre should be zoomed.

Code: Select all

Private Sub InteropUserControl_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AnnotationViewer1.DoubleClick
        Dim eMouse As MouseEventArgs

        If AnnotationViewer1.SelectionMode = Vintasoft.Annotation.SelectionMode.AnnotationView Then
            eMouse = DirectCast(e, MouseEventArgs)
            If _zoomSelection Is Nothing Then
                _zoomSelection = New ZoomSelection(_imageViewer)
            End If
            AnnotationViewer1.VisualTool = _zoomSelection
            _mouseX = eMouse.X.ToString
            _mouseY = eMouse.Y.ToString
            _zoomSelection.Rectangle = New Rectangle(CInt(eMouse.X - 300), CInt(eMouse.Y - 200), 600, 400)
            _zoomSelection.Zoom()
        End If

    End Sub
But never the zoom appears on the selected recangle or the rectangle not created on the place the user has clicked.

Any suggestions?

best regards

Michael

Alex
Site Admin
Posts: 1462
Joined: Thu Jul 10, 2008 2:21 pm

Re: zoomselection

Post by Alex » Tue Feb 21, 2012 2:43 pm

Hello Michael,

You need to use the following code:

Code: Select all

private void ZoomAfterDoubleClick()
{
    ...
    ImageViewer1.DoubleClick += new EventHandler(ImageViewer1_DoubleClick);

    ImageViewer1.Images.Add(Path.Combine(WorkDir, "testimage.tif"));
    ...
}

void ImageViewer1_DoubleClick(object sender, EventArgs e)
{
    MouseEventArgs eMouse;
    eMouse = e as MouseEventArgs;

    Point pointOnImage = imageViewer1.PointToImage(eMouse.Location);

    ZoomSelection selection = new ZoomSelection(ImageViewer1);
    ImageViewer1.VisualTool = selection;

    selection.Rectangle = new Rectangle(pointOnImage.X - 300, pointOnImage.Y - 200, 600, 400);
    selection.Zoom();
}
Best regards, Alexander

MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

Re: zoomselection

Post by MichaelHerrmanns » Tue Feb 28, 2012 11:04 pm

Hello Alex,

thats it.
Now it works.

Thank you

best regards

Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests