我正在开发一个wpf应用程序,我需要一些帮助: 我有一些存储在数据库中的URL。我想在itemscontrol中显示它们 ,我知道该怎么做,但我不知道如何从这个网址预览,如下所示:
我试过这段代码,但图片质量不太好:
WebsitesScreenshot.WebsitesScreenshot _Obj;
_Obj = new WebsitesScreenshot.WebsitesScreenshot();
WebsitesScreenshot.WebsitesScreenshot.Result _Result;
_Result = _Obj.CaptureWebpage("http://www.codeproject.com/");
if (_Result == WebsitesScreenshot.
WebsitesScreenshot.Result.Captured)
{
_Obj.PreserveAspectRatio = true;
_Obj.ImageWidth = 200;
_Obj.ImageHeight = 300;
_Obj.ImageFormat = WebsitesScreenshot.
WebsitesScreenshot.ImageFormats.JPG;
_Obj.SaveImage("D:\\WebpageThumbnailer.jpg");
//_Obj.
}
_Obj.Dispose();
答案 0 :(得分:0)
在您的情况下,请尝试此代码
WebsitesScreenshot.WebsitesScreenshot _Obj;
_Obj = new WebsitesScreenshot.WebsitesScreenshot();
WebsitesScreenshot.WebsitesScreenshot.Result _Result;
_Result = _Obj.CaptureWebpage("http://www.codeproject.com/");
if (_Result == WebsitesScreenshot.
WebsitesScreenshot.Result.Captured)
{
_Obj.PreserveAspectRatio = true;
_Obj.ImageWidth = 200;
_Obj.ImageHeight = 300;
_Obj.JpegQuality = 80;//here you set numbers from 1 to 100
_Obj.ImageFormat = WebsitesScreenshot.
WebsitesScreenshot.ImageFormats.JPG;
_Obj.SaveImage("D:\\WebpageThumbnailer.jpg");
//_Obj.
}
_Obj.Dispose();