LEADTOOLS Windows Forms (Leadtools.WinForms assembly)
LEAD Technologies, Inc

LogicalViewRectangle Property

Example 





Gets the logical view rectangle.
Syntax
[BrowsableAttribute(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public virtual RectangleF LogicalViewRectangle {get;}
'Declaration
 
<BrowsableAttribute(False)>
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
Public Overridable ReadOnly Property LogicalViewRectangle As RectangleF
'Usage
 
Dim instance As RasterImageViewer
Dim value As RectangleF
 
value = instance.LogicalViewRectangle
[BrowsableAttribute(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public virtual RectangleF LogicalViewRectangle {get;}
BrowsableAttribute()
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)
 get_LogicalViewRectangle(); 
[BrowsableAttribute(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public:
virtual property RectangleF LogicalViewRectangle {
   RectangleF get();
}

Property Value

The logical view rectangle.
Remarks

The logical view rectangle is the current viewing rectangle in image coordinates. The value of this property is the current pixel location (in top-left coordinates) of the left, top, right and bottom portion of the image being viewed on the screen.

In RasterPaintSizeMode.Fit, the value of LogicalViewRectangle is always (0, 0, image width in pixels, image height in pixels) since the entire image is always visible.

Since this property represents the values in image coordinates, if you change the HorizontalAlignMode or VerticalAlignMode mode to RasterPaintAlignMode.Center for example, the top and left values of the LogicalViewRectangle property will still be 0,0 since you are still viewing the entire image.

In other size modes, for example RasterPaintSizeMode.Normal, only portion of the image is viewed due to scrolling and zooming setting, the value of LogicalViewRectangle will be the rectangle formed by the left, top, right and bottom pixel "clip" values into the image.

Example
 
Private Sub viewer_BorderPadding(ByVal sender As Object, ByVal e As EventArgs)
   Dim viewer As RasterImageViewer = CType(IIf(TypeOf sender Is RasterImageViewer, sender, Nothing), RasterImageViewer)
   MessageBox.Show(viewer.SizeMode.ToString())
End Sub
Public Sub RasterImageViewer_BorderPadding(ByVal viewer As RasterImageViewer)
   Dim b As ViewerBorderPadding = viewer.BorderPadding
   Dim s As String = String.Format("Border Padding: All {0}  Left {1}  Top {2}  Right {3}  Bottom {4}", b.All, b.Left, b.Top, b.Right, b.Bottom)
   Console.WriteLine(s)
   Console.WriteLine("Image Dpi: (" & viewer.ImageDpiX & ", " & viewer.ImageDpiY & ")")
   Console.WriteLine("Image Size: " & viewer.ImageSize.Width & ", " & viewer.ImageSize.Height)

   s = String.Format("LogicalViewRectangle {0}", viewer.LogicalViewRectangle)
   Console.WriteLine(s)
   s = String.Format("PhysicalViewRectangle {0}", viewer.PhysicalViewRectangle)
   Console.WriteLine(s)

End Sub
private void viewer_BorderPadding(object sender, EventArgs e)
{
   RasterImageViewer viewer = sender as RasterImageViewer;
   MessageBox.Show(viewer.SizeMode.ToString());
}
public void RasterImageViewer_BorderPadding(RasterImageViewer viewer)
{
   ViewerBorderPadding b = viewer.BorderPadding;
   string s = string.Format("Border Padding: All {0}  Left {1}  Top {2}  Right {3}  Bottom {4}", b.All, b.Left, b.Top, b.Right, b.Bottom);
   Console.WriteLine(s);
   Console.WriteLine("Image Dpi: (" + viewer.ImageDpiX + ", " + viewer.ImageDpiY + ")");
   Console.WriteLine("Image Size: " + viewer.ImageSize.Width + ", " + viewer.ImageSize.Height);

   s = string.Format("LogicalViewRectangle {0}", viewer.LogicalViewRectangle);
   Console.WriteLine(s);
   s = string.Format("PhysicalViewRectangle {0}", viewer.PhysicalViewRectangle);
   Console.WriteLine(s);

}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterImageViewer Class
RasterImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.