←Select platform

GetFixedAspectRatioImageRectangle Method

Summary

Calculates how an image is to be sized and positioned in a rectangle while keeping the aspect ratio fixed.

Syntax

C#
VB
C++
public static Rectangle GetFixedAspectRatioImageRectangle(  
   int imageWidth, 
   int imageHeight, 
   Rectangle imageRect 
) 
Public Shared Function GetFixedAspectRatioImageRectangle( _ 
   ByVal imageWidth As Integer, _ 
   ByVal imageHeight As Integer, _ 
   ByVal imageRect As Rectangle _ 
) As Rectangle 
public: 
static Rectangle GetFixedAspectRatioImageRectangle(  
   int imageWidth, 
   int imageHeight, 
   Rectangle imageRect 
) 

Parameters

imageWidth
Width of the image in pixels

imageHeight
Height of the image in pixels

imageRect
The source rectangle

Return Value

A System.Drawing.Rectangle structure that specifies where the image is to be positioned and sized in

imageRect
The source rectangle

Remarks

When the RasterImageList class draws an item image, it tries to fit the image into the item image rectangle while maintaining the aspect ratio. The control internally calls this method to calculate these values.

Example

For an example, refer to DrawItem.

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.WinForms Assembly
Click or drag to resize