Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
ImageToViewerRectangle Method
See Also 
Leadtools.WinForms Namespace > RasterImageViewer Class : ImageToViewerRectangle Method



rect
The rectangle in image coordinates.
accountForViewPerspective
true if rect is already in the image view-perspective. false if rect is in top-left coordinates.
Converts a rectangle in image coordinates to viewer coordinates.

Syntax

Visual Basic (Declaration) 
Public Function ImageToViewerRectangle( _
   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.ImageToViewerRectangle(rect, accountForViewPerspective)
C# 
public Rectangle ImageToViewerRectangle( 
   Rectangle rect,
   bool accountForViewPerspective
)
C++/CLI 
public:
Rectangle ImageToViewerRectangle( 
   Rectangle rect,
   bool accountForViewPerspective
) 

Parameters

rect
The rectangle in image coordinates.
accountForViewPerspective
true if rect is already in the image view-perspective. false if rect is in top-left coordinates.

Return Value

A Rectangle object containing the rectangle coordinates.

Example

For an example, refer to InteractiveUserRectangle.

Remarks

This method converts a rectangle from image (logical) to viewer (physical) coordinates. The viewer coordinates is what you are corrently 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, it is assumed that rect is already in the correct view perspective of the as the current image (RasterImage.ViewPerspective), therefore, no conversion to top-left (which what the physical coordinates are always in) is performed. If however this value is false, then this method will convert rect to top-left coordinates before converting it to physical coordinates.

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

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also