Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Bitmap PrintScreen()
- {
- Rectangle virtualScreen = SystemInformation.VirtualScreen;
- Bitmap bitmap = new Bitmap(virtualScreen.Width, virtualScreen.Height);
- Graphics graphics = Graphics.FromImage((Image) bitmap);
- IntPtr hdc = graphics.GetHdc();
- int dwRop = 13369376;
- SpySource.BitBlt(hdc, 0, 0, virtualScreen.Width, virtualScreen.Height, SpySource.GetDC(IntPtr.Zero), 0, 0, dwRop);
- graphics.ReleaseHdc(hdc);
- graphics.Dispose();
- return bitmap;
- }
- private Bitmap PrintScreen(int width, int height)
- {
- Rectangle virtualScreen = SystemInformation.VirtualScreen;
- Bitmap bitmap1 = new Bitmap(virtualScreen.Width, virtualScreen.Height);
- Graphics graphics1 = Graphics.FromImage((Image) bitmap1);
- IntPtr hdc = graphics1.GetHdc();
- int dwRop = 13369376;
- SpySource.BitBlt(hdc, 0, 0, virtualScreen.Width, virtualScreen.Height, SpySource.GetDC(IntPtr.Zero), 0, 0, dwRop);
- graphics1.ReleaseHdc(hdc);
- graphics1.Dispose();
- if (virtualScreen.Width == width && virtualScreen.Height == height)
- return bitmap1;
- Bitmap bitmap2 = new Bitmap(width, height);
- Graphics graphics2 = Graphics.FromImage((Image) bitmap2);
- graphics2.DrawImage((Image) bitmap1, 0, 0, width, height);
- bitmap1.Dispose();
- graphics2.Dispose();
- return bitmap2;
- }
- private Bitmap PrintScreen2(int width, int height)
- {
- Rectangle virtualScreen = SystemInformation.VirtualScreen;
- Bitmap bitmap = new Bitmap(width, height);
- Graphics graphics = Graphics.FromImage((Image) bitmap);
- IntPtr hdc = graphics.GetHdc();
- int dwRop = 13369376;
- SpySource.StretchBlt(hdc, 0, 0, width, height, SpySource.GetDC(IntPtr.Zero), 0, 0, virtualScreen.Width, virtualScreen.Height, dwRop);
- graphics.ReleaseHdc(hdc);
- graphics.Dispose();
- return bitmap;
- }
Advertisement
Add Comment
Please, Sign In to add comment