using System.Drawing.Imaging;
private static Bitmap ScreenImage;
private static Graphics ScreenGraphic;
private void CaptureScreen()
{
ScreenImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
ScreenGraphic= Graphics.FromImage(ScreenImage); //Convert from image to graphic
ScreenGraphic.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
ScreenImage .Save(AppDomain.CurrentDomain.BaseDirectory + "MyScreenShot", ImageFormat.Png);
}
Không có nhận xét nào:
Đăng nhận xét