Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 17, 2010 3:56:42 AM(UTC)
username77

Groups: Registered
Posts: 40

Thanks: 5 times

Hello
Im using vb.net and LT v17

In WindowsForm using RasterImageViewer
I need to capture the coordinates of an loaded image in Rasterimageviewer and then calling those coordinates when i load another image in Rasterimageviewer.

any help is appreciated

Best regards
AN
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 17, 2010 5:14:00 AM(UTC)
username77

Groups: Registered
Posts: 40

Thanks: 5 times

Probably i found the solution.

I capure the coordinates in this way:

Dim trans As New Transformer(RasterImageViewer1.Transform)

Dim rectF As New RectangleF(CSng(RasterImageViewer1.ClientRectangle.X), CSng(RasterImageViewer1.ClientRectangle.Y), CSng(RasterImageViewer1.ClientRectangle.Width), CSng(RasterImageViewer1.ClientRectangle.Height))

rectF = trans.RectangleToLogical(rectF)

rectF contain X, Y, Width, Height
RasterImageViewer1.ScaleFactor contain the ZoomFactor


Now i load the other image on this way:

TxtBoxX_R, TxtBoxY_R, TxtBoxW_R, TxtBoxH_R are the captured coordinates and TxtBoxZ_R zoom factor.

Dim viewer As RasterImageViewer = RasterImageViewer1 ' get the active viewer
Dim Rect As New Rectangle(CInt(TxtBoxX_R), CInt(TxtBoxY_R), CInt(TxtBoxW_R), CInt(TxtBoxH_R))

Dim trans As New Transformer(viewer.Transform)
Dim RectF As New RectangleF(Rect.X, Rect.Y, Rect.Width, Rect.Height)
RectF = trans.RectangleToPhysical(RectF)

'Dim viewer As RasterImageViewer = RasterImageViewer1 ' get the active viewer
Dim center As PointF = New PointF(RectF.Left + CInt(RectF.Width / 2), RectF.Top + CInt(RectF.Height / 2)) ' get the center of what you see in physical coordinates

Dim t As Transformer = New Transformer(viewer.Transform)
center = t.PointToLogical(center) ' get the center of what you see in logical coordinates
' zoom

Dim scaleFactor As Double = CDbl(TxtBoxZ_R)
viewer.ScaleFactor = scaleFactor
' bring the original center into the view center
t = New Transformer(viewer.Transform)
center = t.PointToPhysical(center) ' get the center of what you saw before the zoom in physical coordinates
viewer.CenterAtPoint(Point.Round(center)) ' bring the old center into the center of the view




 
#3 Posted : Friday, November 19, 2010 12:34:48 PM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Do you want to get the coordinates of the image area that is visible?  You can just get the ScrollPosition and multiply it by the ScaleFactor.  That will give you the X and Y position, and then you can get the size of the RasterImageViewer and multiply it by the ScaleFactor to get the width and the height.

Thanks
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.051 seconds.