看板 C_Sharp 關於我們 聯絡資訊
※ 引述《casiopea (Casiopea)》之銘言: : 不曉得各位板友是否知道 SnagIt 這套截圖軟體? : 它可以擷取 滑鼠框選的區域、 : 特定視窗、 : 視窗中特定區塊(自動偵測某個region,例如整個toolbar、整個panel) : 總之是個非常好用的軟體,除了多樣化的截取區域之外,也可以自動批次存檔、上傳到FTP : 甚至還提供了簡單的編修功能(陰影、模糊、加圖、加字等等) : 其中針對截圖這塊,我實在不知該看些什麼資料? : 目前根據它的截圖流程,我猜是跟 Windows OS 本身的 API 有關 : (它會將目前畫面定格以方便選取截圖區域) : 但卻不知道該怎麼實作 1. 如何將畫面定格? : 2. 定格後如何進行截圖或是自動偵測特定區域? : 想請教板友有無任何參考文件或是open source project可供參考? : 感激不盡~ 剛好前陣子有再研究 不過我是對 webbrowser 作截圖 你看看這兩個方法何不合你用 1. // Set hwnd to the Window IntPtr myIntptr = handle of Window; int hwndInt = myIntptr.ToInt32(); IntPtr hwnd = myIntptr; // Set hdc to the bitmap Bitmap bm = new Bitmap(screenWidth, screenHeight, System.Drawing.Imaging.PixelFormat.Format16bppRgb555); Graphics g = Graphics.FromImage(bm); IntPtr hdc = g.GetHdc(); // Snapshot the WebBrowser bool result = PrintWindow(hwnd, hdc, 0); g.ReleaseHdc(hdc); g.Flush(); // Save the bitmap, if successful if (result == true) bm.Save("slide.bmp"); 2. Graphics g = webBrowser1.CreateGraphics(); Bitmap ibitMap = new Bitmap(webBrowser1.Width, webBrowser1.Height, g); Graphics iBitMap_gr = Graphics.FromImage(ibitMap); IntPtr iBitMap_hdc = iBitMap_gr.GetHdc(); IntPtr me_hdc = g.GetHdc(); BitBlt(iBitMap_hdc, 0, 0, webBrowser1.Width, webBrowser1.Height, me_hdc, 0, 0, SRC); g.ReleaseHdc(me_hdc); iBitMap_gr.ReleaseHdc(iBitMap_hdc); ibitMap.Save("1.bmp", ImageFormat.Bmp); 第二個 我比較看不懂 不過似乎可以抓螢幕上 某範圍的畫面 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.231.156