LEADTOOLS Windows Forms (Leadtools.WinForms assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
ViewerToImageRectangle Method
See Also 
Leadtools.WinForms Namespace > RasterImageViewer Class : ViewerToImageRectangle Method



rect
The rectangle in viewer coordinates.
accountForViewPerspective
true to return the coordinates in the current Image view perspective. false to return the coordinates in top-left view perspective.
rect
The rectangle in viewer coordinates.
accountForViewPerspective
true to return the coordinates in the current Image view perspective. false to return the coordinates in top-left view perspective.
Converts a rectangle in viewer coordinates to image coordinates.

Syntax

Visual Basic (Declaration) 
Public Function ViewerToImageRectangle( _
   ByVal rect As Rectangle, _
   ByVal accountForViewPerspective As Boolean _
) As Rectangle
Visual Basic (Usage)Copy Code
Dim instance As RasterImageViewer
Dim rect As Rectangle
Dim accountForViewPerspective As Boolean
Dim value As Rectangle
 
value = instance.ViewerToImageRectangle(rect, accountForViewPerspective)
C# 
public Rectangle ViewerToImageRectangle( 
   Rectangle rect,
   bool accountForViewPerspective
)
C++/CLI 
public:
Rectangle ViewerToImageRectangle( 
   Rectangle rect,
   bool accountForViewPerspective
) 

Parameters

rect
The rectangle in viewer coordinates.
accountForViewPerspective
true to return the coordinates in the current Image view perspective. false to return the coordinates in top-left view perspective.

Return Value

A System.Drawing.Rectangle object containing the rectangle coordinates.

Example

For an example, refer to InteractiveUserRectangle.

Remarks

This method converts a rectangle from viewer (physical) to image (logical) coordinates. The viewer coordinates is what you are currently seeing on the screen. It contains the current scale and scroll values (as well as any padding if set). For example, when you use the RasterViewerInteractiveMode.UserRectangle, the value obtained from the RasterViewerRectangleEventArgs.Rectangle parameter to the InteractiveUserRectangle event is in physical coordinates. If you need to convert this value to image coordinates (for example, to use it as a region or to find the exact pixel coordinate of this rectangle in the image) then you should use the ViewerToImageRectangle method.

When accountForViewPerspective is set to true, the return rectangle value is in the same view perspective as the current image (RasterImage.ViewPerspective) which might not be necessary in top-left coordinates. If this value is false, the return value is always in top-left coordinates.

To convert from image (logical) to viewer (physical) coordinates, use the ImageToViewerRectangle method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also