0
我一直在研究一個引擎一段時間,光標很小,所以我想知道如何更改高度和寬度。這是我正在使用的代碼。如何繪製寬度和高度的剪切圖像c#
public void drawCutImage(int cutX, int cutY, int cutWidth, int cutHeight, int drawX, int drawY, Image image)
{
// Clone a portion of the Bitmap object.
Rectangle sourceRect = new Rectangle(cutHeight * cutX, cutWidth * cutY, cutWidth, cutHeight);
System.Drawing.Imaging.PixelFormat format =
image.PixelFormat;
// Draw the cloned portion of the Bitmap object.
sCanvas.DrawImage(image, drawX, drawY, sourceRect, GraphicsUnit.Pixel);
}
但我希望能夠做到這一點
sCanvas.DrawImage(image, drawX, drawY, drawWidth, drawHeight, sourceRect, GraphicsUnit.Pixel);
試試[this](http://msdn.microsoft.com/de-de/library/ms142040%28v=vs.110%29.aspx)格式!它會做你想做的。 – TaW