PRB: DrawImage Supports Only the Pixel Graphics Unit (317229)



The information in this article applies to:

  • Microsoft GDI+ 1.0
  • Microsoft .NET Framework 1.0
  • Microsoft .NET Framework 1.1
  • the operating system: Microsoft Windows XP 64-Bit Edition
  • 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.

Modification Type:MinorLast Reviewed:4/12/2006
Keywords:kbDSWGDI2003Swept kbgdipimaging kbprb KB317229