1.Drawimage
6.1 drawimage (image, Int, INT)
6.1 drawimage (image, rectangle)
6.2 drawimage (image, rectangle [Destrect
], Rectangle [Srcrect
], Graphicsunit)
In the specified position and draw according to the specified sizeImage
The specified part of the object.
Rectangle [Destrect
]
It specifies the position and size of the image to be drawn. Scale the image to fit the rectangle.
Rectangle [Srcrect
]
It specifies Image
The part of the object to be drawn.
Used for interpolation to control image quality; cut Images
Private void formatepaint (Object sender, system. Windows. Forms. painteventargs E)
{// Interpolation controls Image Quality
Graphics G = E. graphics;
Bitmap BMP = new Bitmap ("a006.jpg ");
G. fillrectangle (brushes. White, this. clientrectangle );
Int width = BMP. width;
Int Height = BMP. height;
G. drawimage (
BMP,
New rectangle (200,200 ),
New rectangle (0, 0, width, height ),
Graphicsunit. pixel );
G. interpolationmode = interpolationmode. nearestneighbor;
G. drawimage (
BMP,
New rectangles (10,250,200,200 ),
New rectangle (0, 0, width, height ),
Graphicsunit. pixel );
G. interpolationmode = interpolationmode. highqualitybicubic;
G. drawimage (
BMP,
New rectangles (250,250,200,200 ),
New rectangle (0, 0, width, height ),
Graphicsunit. pixel );
}
Private void formatepaint (Object sender, system. Windows. Forms. painteventargs E)
{// Cut the image
Graphics G = E. graphics;
Bitmap BMP = new Bitmap ("a006.jpg ");
G. fillrectangle (brushes. White, this. clientrectangle );
Int width = BMP. width;
Int Height = BMP. height;
G. drawimage (
BMP,
New rectangle (200,200 ),
New rectangle (150,150 ),
Graphicsunit. pixel );
}
6.3 drawimage (image, point [3])
It can be used for image deformation, turning, and rotating.
Specify coordinates in the upper left corner at the first point.
Second, specify the coordinates in the upper-right corner.
Third, specify coordinates in the lower left corner.
Private void formatepaint (Object sender, system. Windows. Forms. painteventargs E)
{// Image deformation
Graphics G = E. graphics;
Bitmap BMP = new Bitmap ("a006.jpg ");
G. fillrectangle (brushes. White, this. clientrectangle );
Point [] destinationpoints = {
New Point (0, 0 ),
New Point (100,0 ),
New Point (50,100 )};
G. drawimage (BMP, destinationpoints );
}