public void GoruntuyuYakala(bool imlec, Rectangle rc) { try { Point imlec_pozisyon = new Point(Cursor.Position.X, Cursor.Position.Y); Size imlec_boyut = new Size(); imlec_boyut.Height = Cursor.Current.Size.Height; imlec_boyut.Width = Cursor.Current.Size.Width; Rectangle Sinirlar; if (rc.Width != 0 && rc.Height != 0 && rc.X != 0 && rc.Y != 0) { Bitmap image1 = new Bitmap(rc.Width, rc.Height); Graphics g = Graphics.FromImage(image1); g.CopyFromScreen(new Point(rc.X, rc.Y), Point.Empty, rc.Size); Image image = SCapture.Control(Control.MousePosition, Settings.Default.imlec); imgBox.Image = image1; this.Show(); this.WindowState = FormWindowState.Maximized; image.Dispose(); Formislemleri(); } else { Sinirlar = Screen.GetBounds(Screen.GetBounds(Point.Empty)); Goruntuyu_al(imlec, imlec_boyut, imlec_pozisyon, Point.Empty, Point.Empty, Sinirlar); Formislemleri(); } } catch { } }
public static Bitmap DisplayMonitor(Screen monitor, bool includeCursor) { if (monitor != null) { return(SCapture.ScreenRectangle(monitor.Bounds, includeCursor)); } throw new SCaptureException("The monitor cannot be Null (Nothing in VB)."); }
public static Bitmap Window(IntPtr handle, bool includeCursor) { if (handle != IntPtr.Zero) { return(SCapture.Control(handle, includeCursor)); } throw new SCaptureException("Invalid window handle."); }
public static Bitmap Control(Point screenPoint, bool includeCursor) { IntPtr intPtr = SCapture.UnsafeNativeMethods.WindowFromPoint(screenPoint); if (intPtr != IntPtr.Zero) { return(SCapture.Control(intPtr, includeCursor)); } throw new SCaptureException("Could not find any control at the specified point."); }
public static Bitmap ActiveWindow(bool includeCursor) { IntPtr foregroundWindow = SCapture.UnsafeNativeMethods.GetForegroundWindow(); if (foregroundWindow != IntPtr.Zero) { return(SCapture.Control(foregroundWindow, includeCursor)); } throw new SCaptureException("Could not find any active window."); }
public static Bitmap ScreenRectangle(Rectangle rect, bool includeCursor) { if (!rect.IsEmpty && rect.Width != 0 && rect.Height != 0) { Bitmap image = SCapture.GetImage(rect); if (includeCursor) { SCapture.DrawCursor(rect, image); } return(image); } throw new SCaptureException("Empty rectangle."); }
public static Bitmap Control(IntPtr handle, bool includeCursor) { if (!(handle != IntPtr.Zero)) { throw new SCaptureException("Invalid control handle."); } if (!SCapture.UnsafeNativeMethods.GetWindowRect(handle, ref rect)) { int lastWin32Error = Marshal.GetLastWin32Error(); throw new SCaptureException(new Win32Exception(lastWin32Error).Message); } return(SCapture.ScreenRectangle(rect.ToRectangle(), includeCursor)); }
private static void DrawCursor(Rectangle rect, Bitmap bmp) { SCapture.CursorInfo cursorInfo = SCapture.GetCursorInfo(); checked { if (cursorInfo.flags == 1u && rect.Contains(cursorInfo.ptScreenPos)) { IntPtr cursorIcon = SCapture.GetCursorIcon(cursorInfo.hCursor); SCapture.IconInfo iconInfo = SCapture.GetIconInfo(cursorIcon); Graphics graphics = Graphics.FromImage(bmp); graphics.DrawIcon(Icon.FromHandle(cursorIcon), (int)(unchecked ((long)(checked (cursorInfo.ptScreenPos.X - rect.X))) - (long)(unchecked ((ulong)iconInfo.xHotspot))), (int)(unchecked ((long)(checked (cursorInfo.ptScreenPos.Y - rect.Y))) - (long)(unchecked ((ulong)iconInfo.yHotspot)))); graphics.Dispose(); } } }
public static Bitmap Window(Point screenPoint, bool includeCursor) { IntPtr intPtr = SCapture.UnsafeNativeMethods.WindowFromPoint(screenPoint); if (!(intPtr != IntPtr.Zero)) { throw new SCaptureException("Could not find any window at the specified point."); } IntPtr ancestor = SCapture.UnsafeNativeMethods.GetAncestor(intPtr, 3u); if (ancestor != IntPtr.Zero) { return(SCapture.Control(ancestor, includeCursor)); } return(SCapture.Control(intPtr, includeCursor)); }
private static Bitmap GetImage(Rectangle rect) { IntPtr dc = SCapture.GetDC(); return(SCapture.GetImage(dc, rect)); }
public static Bitmap FullScreen(bool includeCursor) { return(SCapture.ScreenRectangle(SystemInformation.VirtualScreen, includeCursor)); }