我在网上看了一段时间,似乎找不到我一直在寻找的答案。因此,我打算用位图来绘制它们到窗口上,并且能够在任何时候适当地调整它们的大小。任何帮助都将不胜感激!
发布于 2015-02-18 04:21:38
对于那些不知道的人,您可以使用矩阵来转换、调整大小和旋转。这是怎么做的。另外,在绘制实际对象之前,一定要更改RenderTarget的矩阵。
Vector2
RenderTarget.Transform
RenderTarget.DrawBitmap
Matrix.Transformation2D
Vector2 center = new Vector2(bitmap.Size.Width / 2, bitmap.Size.Height / 2);
renderTarget.Transform = Matrix.Transformation2D(center, 0f, new Vector2(width / bitmap.Size.Width, height / bitmap.Size.Height), center, MathHelper.ToRads(rotation), new Vector2(x - center.X, y - center.Y));
renderTarget.DrawBitmap(bitmap, 1f, BitmapInterpolationMode.NearestNeighbor);
renderTarget.Transform = Matrix.Transformation2D(Vector2.Zero, 0f, new Vector2(1f, 1f), Vector2.Zero, MathHelper.ToRads(0), Vector2.Zero);
https://stackoverflow.com/questions/28373511
复制相似问题