using _SCREEN_CAPTURE; using System; using System.Collections.Generic; using System.Drawing; using System.Text; namespace ryCommon._SCREEN_CAPTURE { /// /// /// public class ScreenCapture { private FrmCapture m_frmCapture; /// /// /// /// /// public static Bitmap DeepCopyBitmap(Bitmap bitmap) { try { Bitmap dstBitmap = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), bitmap.PixelFormat); return dstBitmap; } catch (Exception ex) { Console.WriteLine("Error : {0}", ex.Message); return null; } } /// /// 开始截图 /// /// 是否截取鼠标指针 /// public Bitmap StartCapture(bool IsCaptureCursor) { if (m_frmCapture == null || m_frmCapture.IsDisposed) m_frmCapture = new FrmCapture(); m_frmCapture.IsCaptureCursor = IsCaptureCursor; m_frmCapture.ShowDialog(); if(m_frmCapture.IsCapture) { Bitmap bit = DeepCopyBitmap(m_frmCapture.m_bmpLayerCurrent); m_frmCapture.m_bmpLayerCurrent.Dispose(); return bit; } return null; } } }