我正在尝试制作一个应用程序,它使用多个具有不同名称的屏幕截图,并将它们保存在我的桌面或其他地方。
有人能帮帮我吗。我想我可以用它和循环,但我不知道怎么做
我有个截图代码:
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
bmp.Save("screenshot.png"); // saves the image
}发布于 2014-03-17 17:53:16
您需要创建一个Bitmap数组,然后使用for循环创建屏幕截图,并使用循环索引命名它们。
然后使用Bitmap.save(Location)保存;
就像这样
Bitmap[] screenshot = new Bitmap[10];
String name = "Screenshot";
for(int i = 0; i < 10 ; i++)
{
screenshot[i] = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
screenshot[i].Save("PATH" + name + i);
}https://stackoverflow.com/questions/22461557
复制相似问题