0
我有一个带有几个按钮的窗体应用程序,当我点击一个按钮时,我想在窗体屏幕上显示一个位图图像。所以,基本上我所做的是:在c#窗体窗体应用程序中加载位图图像
public static Bitmap[] images;
Bitmap tileSheet = new Bitmap(filename);
images = new Bitmap[256];
public static void LoadImages(string filename)
{
Bitmap tileSheet = new Bitmap(filename);
images = new Bitmap[256];
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x++)
{
images[y * 16 + x] = new Bitmap(32, 32);
Graphics g = Graphics.FromImage(images[y * 16 + x]);
g.DrawImage(tileSheet, new Rectangle(0, 0, 32, 32), new Rectangle(x * 32, y * 32, 32, 32), GraphicsUnit.Pixel);
}
}
}
的功能告诉我该怎么图像的大小应该和伊夫declaired位图,但我怎么acctually从我的电脑中加载图像?