Microsoft KB Archive/317229

= PRB: DrawImage Supports Only the Pixel Graphics Unit =

Article ID: 317229

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft GDI+ 1.0
 * Microsoft .NET Framework 1.0
 * Microsoft .NET Framework 1.1
 * Microsoft Windows XP Professional for Itanium-based systems
 * Microsoft Windows XP Professional

-



This article was previously published under Q317229



Notice
This article references the following .NET Framework Class Library namespace:
 * System.Drawing



SYMPTOMS
In GDI+ 1.0, the DrawImage overloaded methods, which include a GraphicsUnit parameter, support only the Pixel graphics unit.



STATUS
This behavior is by design.



MORE INFORMATION
The GraphicsUnit enumeration specifies the unit of measure for the given data. When used in the DrawImage method, GraphicsUnit specifies the unit of measure used by the source coordinates.

When you call a DrawImage overload, which includes the GraphicsUnit enumerator as a parameter, you must specify GraphicsUnit.Pixel. For example, the following call to DrawImage fails because the Inch graphics unit is used: float width = 800.0F; float height = 600.0F; GraphicsUnit units = GraphicsUnit.Inch; e.Graphics.DrawImage(newImage, destRect1, 0.0F, 0.0F, width, height, units); When you replace the Inch graphics unit with GraphicsUnit.Pixel, the call succeeds.

Keywords: kbdswgdi2003swept kbgdipimaging kbprb KB317229

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.