Click here to Skip to main content
16,021,417 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I am trying to generate screenshots for swf by loading them in webbrowser in visual c# . i use openfiledialog() to select my SWF Files
i have used the function of webbrowser WebBrowser.DrawtoBitmap(), but i get blank images
below is my code
help will be appreciated
Quote:

namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{

public WebBrowser wb = new WebBrowser();
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{


this.openFileDialog1.ShowDialog();
string[] files = openFileDialog1.FileNames;
foreach (string nam in files)
{
try
{

string url = @"file:///" + nam;
wb.Navigate(url);
Bitmap b = new Bitmap(wb.Width, wb.Height);
wb.DrawToBitmap(b, new Rectangle(0, 0, wb.Width, wb.Height));
b.Save(@"D:\copy\" + Path.GetFileNameWithoutExtension(nam) + ".png", System.Drawing.Imaging.ImageFormat.Png);
wb.Dispose();

}

catch
{ }

}

}

}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900