欧美成人精品手机在线观看_69视频国产_动漫精品第一页_日韩中文字幕网 - 日本欧美一区二区

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

[點晴永久免費OA]C#將網址生成圖片

admin
2022年12月22日 10:57 本文熱度 806

輸入任意網址.把該網址打開的網頁生成圖片

GetImage類

public class GetImage
    {
private int S_Height;
private int S_Width;
private int F_Height;
private int F_Width;
private string MyURL;

public int ScreenHeight
{
get { return S_Height; }
set { S_Height = value; }
}

public int ScreenWidth
{
get { return S_Width; }
set { S_Width = value; }
}

public int ImageHeight
{
get { return F_Height; }
set { F_Height = value; }
}

public int ImageWidth
{
get { return F_Width; }
set { F_Width = value; }
}

public string WebSite
{
get { return MyURL; }
set { MyURL = value; }
}

public GetImage(string WebSite, int ScreenWidth, int ScreenHeight, int ImageWidth, int ImageHeight)
{
this.WebSite = WebSite;
this.ScreenWidth = ScreenWidth;
this.ScreenHeight = ScreenHeight;
this.ImageHeight = ImageHeight;
this.ImageWidth = ImageWidth;
}

public Bitmap GetBitmap()
{
WebPageBitmap Shot = new WebPageBitmap(this.WebSite, this.ScreenWidth, this.ScreenHeight);
Shot.GetIt();
Bitmap Pic = Shot.DrawBitmap(this.ImageHeight, this.ImageWidth);
return Pic;
}

}
class WebPageBitmap
{
WebBrowser MyBrowser;
string URL;
int Height;
int Width;

public WebPageBitmap(string url, int width, int height)
{
this.Height = height;
this.Width = width;
this.URL = url;
MyBrowser = new WebBrowser();
MyBrowser.ScrollBarsEnabled = false;
MyBrowser.WebBrowserShortcutsEnabled = false;
MyBrowser.ObjectForscripting = false;
MyBrowser.Size = new Size(this.Width, this.Height);
}

public void GetIt()
{
MyBrowser.Navigate(this.URL);
while (MyBrowser.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
}

public Bitmap DrawBitmap(int theight, int twidth)
{
Bitmap myBitmap = new Bitmap(Width, Height);
Rectangle DrawRect = new Rectangle(0, 0, Width, Height);
MyBrowser.DrawToBitmap(myBitmap, DrawRect);
System.Drawing.Image imgOutput = myBitmap;
System.Drawing.Image oThumbNail = new Bitmap(twidth, theight, imgOutput.PixelFormat);
Graphics g = Graphics.fromImage(oThumbNail);
g.CompositingQuality = CompositingQuality.HighSpeed;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
Rectangle orectangle = new Rectangle(0, 0, twidth, theight);
g.DrawImage(imgOutput, orectangle);
try
{

return (Bitmap)oThumbNail;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
finally
{
imgOutput.Dispose();
imgOutput = null;
MyBrowser.Dispose();
MyBrowser = null;
}
}
}
public class OLayer
{
public void CaptureImage(string url)
{
System.Drawing.Bitmap x = null;
try
{
// string url = "http://" + Request.Url.Host + ":" + Request.Url.Port.ToString();
//url = url + UrlPath;

//GetImage thumb = new GetImage(url, 1024, 3200, 1024, 3200);
//生成頁面圖片的長寬高
GetImage thumb = new GetImage(url, 1024, 8000, 1024, 8000);
x = thumb.GetBitmap();
string FileName = DateTime.Now.ToString("yyyyMMddhhmmss");

//x.Save(System.Environment.CurrentDirectory + "\\cap\\" + FileName + ".jpg");
x.Save(System.Environment.CurrentDirectory + FileName + ".jpg");


//CaptureState = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
//CaptureState = false;
}
finally
{
if (x != null) x.Dispose();
}
}
}

頁面調用:

 OLayer ow = new OLayer();
ow.CaptureImage(tstr[i].ToString());

該文章在 2022/12/22 10:57:12 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved