C#如何截取当前程序窗口的截图
展开全部
Bitmap bit = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(bit);
g.CopyFromScreen(new Point(this.Location.X,this.Location.Y), new Point(0, 0), bit.Size);
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "bmp|*.bmp|jpg|*.jpg|gif|*.gif";
if (saveFileDialog.ShowDialog() != DialogResult.Cancel)
{
bit.Save(saveFileDialog.FileName);
}
g.Dispose();
}
Graphics g = Graphics.FromImage(bit);
g.CopyFromScreen(new Point(this.Location.X,this.Location.Y), new Point(0, 0), bit.Size);
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "bmp|*.bmp|jpg|*.jpg|gif|*.gif";
if (saveFileDialog.ShowDialog() != DialogResult.Cancel)
{
bit.Save(saveFileDialog.FileName);
}
g.Dispose();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询