0
我有一个比我想要绘制的大小大得多的PNG图像。我也有一个矩形,我想要PNG填充。我曾尝试这个代码,但它并没有调整PNG:WP7 C#XNA调整大小精灵
public void Draw(SpriteBatch batch, float screenWidth)
{
Rectangle destinationRectangle = new Rectangle(0, 0, 0, 0);
destinationRectangle.Width = (int)(screenWidth/8);
destinationRectangle.Height = (int)(screenWidth/8);
Vector2 topLeft = new Vector2(0, 0);
batch.Begin();
batch.Draw(GamePage.theImage, topLeft, destinationRectangle, Color.Transparent);
batch.End();
}
感谢
你用错了。 'batch.Draw(GamePage.theImage,destinationRectangle,Color.Transparent)' - 如果使用'destinationRectangle',你的意思是“*我想把它绘制在*处”。虽然我无法想象为什么你会想要透明的颜色。 – neeKo