Adjusts the given rectangle based on the given paint mode properties.
Syntax
Parameters
- sourceWidth
- The width of the source rectangle.
- sourceHeight
- The height of the source rectangle.
- destinationRectangle
- Destination rectangle.
- sizeMode
- Controls how the source rectangle is positioned inside the destination rectangle.
- horizontalAlignMode
- Controls how the source rectangle is aligned horizontally inside the destination rectangle.
- verticalAlignMode
- Controls how the source rectangle is aligned vertically inside the destination rectangle.
Return Value
The new destination rectangle adjusted based on the size mode and alignment.
Example
Visual Basic |
Copy Code |
Public Sub CalculatePaintModeRectangleExample() Dim client As Rectangle = New Rectangle(0, 0, 500, 500) Dim fit As Rectangle = RasterImage.CalculatePaintModeRectangle(3000, 1000, client, RasterPaintSizeMode.Fit, RasterPaintAlignMode.Near, RasterPaintAlignMode.Near) Console.WriteLine("{0},{1},{2},{3}", fit.Left, fit.Top, fit.Right, fit.Bottom) End Sub |
C# |
Copy Code |
public void CalculatePaintModeRectangleExample() { // assume image width/height of 3000 x 1000 // assume client rectangle of 500 x 500 Rectangle client = new Rectangle(0, 0, 500, 500); Rectangle fit = RasterImage.CalculatePaintModeRectangle(3000, 1000, client, RasterPaintSizeMode.Fit, RasterPaintAlignMode.Near, RasterPaintAlignMode.Near); Console.WriteLine("{0},{1},{2},{3}", fit.Left, fit.Top, fit.Right, fit.Bottom); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also