2010-06-25 70 views
2

有很多python,php的開源屏幕抓取庫。但是我找不到任何.Net相應的東西。你可以推薦任何圖書館的屏幕抓取或只是HTML解析,讓生活更輕鬆。有沒有用於屏幕抓取的任何C#庫?

+0

我認爲這是重複的,請檢查這兩個:http://stackoverflow.com/questions/100358/looking-for-c-html-parser http://stackoverflow.com/questions/653357/html-解析庫-for-net – Adirael 2010-06-25 08:09:44

回答

2

方法實現:

public static void CaptureImage(Point SourcePoint, Point DestinationPoint, 
     Rectangle SelectionRectangle, string FilePath) 
     { 
     using (Bitmap bitmap = new Bitmap(SelectionRectangle.Width, 
      SelectionRectangle.Height)) 
      { 
      using (Graphics g = Graphics.FromImage(bitmap)) 
       { 
       g.CopyFromScreen(SourcePoint, DestinationPoint, 
        SelectionRectangle.Size); 
       } 
      bitmap.Save(FilePath, ImageFormat.Bmp); 
      } 
     } 
    } 

後續調用:

Point StartPoint = new Point(ClickPoint.X, ClickPoint.Y); 
Rectangle bounds = new Rectangle(ClickPoint.X, ClickPoint.Y, 
    CurrentPoint.X - ClickPoint.X, CurrentPoint.Y - ClickPoint.Y); 
ScreenShot.CaptureImage(StartPoint, Point.Empty, bounds, ScreenPath); 

感謝原作者@http://www.codeproject.com/KB/cs/TeboScreen.aspx

+0

屏幕截圖不是屏幕抓取 – emd 2012-09-24 20:20:59

0

使用來自IRobotSoft的IRobot。