2012-07-05 73 views
0

如何從GeckoFX瀏覽器中的頁面獲取圖像?如何在GeckoFX瀏覽器中下載圖片?

我知道我可以簡單地獲取'src'屬性的值,然後使用WebClient來下載文件,但我需要從瀏覽器中獲取它,否則圖片將在下次下載時更改。

回答

1

但是你可以把這個代碼轉換成等上下文菜單條時,圖像是右鍵單擊:

if(geckoWebBrowser1.CopyImageContents())//if image contents can be copied... 
{ 
    System.Drawing.Image img = Clipboard.GetImage();//copy image into variable 

    //here you can use a folder browser dialog to locate path manualy 
    img.Save(Application.StartupPath + "tempImg.jpg");//will save image to path 

    //last two lines is optional and can open same image in default image preview program 
    string fak = Application.StartupPath + "tempImg.jpg"; 
    System.Diagnostics.Process.Start(fak); 
} 
相關問題