此代碼與saveFileDialog捕捉web瀏覽器圖像
private void salvaUnImmagineToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
SaveAsBitmap(webBrowser1, saveFileDialog1.FileName);
}
}
public void SaveAsBitmap(Control control, string fileName)
{
//getthe instance of the graphics from the control
Graphics g = control.CreateGraphics();
//new bitmap object to save the image
Bitmap bmp = new Bitmap(control.Width, control.Height);
//Drawing control to the bitmap
control.DrawToBitmap(bmp, new Rectangle(0, 0, control.Width, control.Height));
bmp.Save(fileName);
bmp.Dispose();
}
節省我如何能捕捉Web瀏覽器的圖像後返回一個白色的形象?
非常感謝,它是完美的! – jolly