Graphics.DrawImage缩小显示的图像?

时间:2018-07-15 17:12:15

标签: c# drawimage sizing

  

edit:谢谢您的所有答复,我只是发现bmpSize固定了大小。我还根据Plutonix的建议添加了一个数组。谢谢大家!

使用Visual Studio开发游戏,这是使用C#进行编程的新手。我正在使用switch语句和Graphics.DrawImage方法从文本文件生成地图。图像按24x24像素缩放,画布为979x571。由于某些原因,我的图像显示得很小。我已经尝试过使用给定的Graphics.DrawImage方法调整大小,但是它只能在一块瓷砖上创建缩放比例。 (((我也可以添加尝试实现此代码的代码。尝试保持简短。))

我在地图上有一个较大的播放器对象以供参考,该地图的尺寸​​应与黄色播放器一样大。

                case 'W':
                    e.Graphics.DrawImage(Properties.Resources.wall, countCol, countRow);
                    countCol = countCol + 8;
                    break;
                case 'G':
                    e.Graphics.DrawImage(Properties.Resources.grass, countCol, countRow);
                    countCol = countCol + 8;
                    break;
                case 'P':
                    e.Graphics.DrawImage(Properties.Resources.player, countCol, countRow);
                    countCol = countCol + 8;
                    break;

The map scaled much smaller.

0 个答案:

没有答案