使用GDI +我试图制作一个由图像组成的简单正方形。这个矩形将被移动。我遇到了一些问题。首先,如何在图像中局部引用图像(设置为始终复制),如何让图像以正方形为中心,以及如何在方块移动时保持图像静止?如何使用TextureBrush绘制图像
Bitmap runnerImage = (Bitmap)Image.FromFile(@"newRunner.bmp", true);//this results in an error without full path
TextureBrush imageBrush = new TextureBrush(runnerImage);
imageBrush.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;//causes the image to get smaller/larger if movement is tried
Graphics.FillRectangle(imageBrush, displayArea);
在不使用wrapMode.clamp默认为平铺,它看起来像图像平铺和移动从一个图像的方移动到下一
我编辑了自己的冠军。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 –
当你说静止的时候,你的意思是图像在它移动的方块中居中。 –
@MikeAbyss是的,理想情况下,广场会四处移动,图像将始终居中在广场内。 – Centimane