Example #1
0
        public MouseCapture()
        {
            IntPtr desk = PInvoke.GetDesktopWindow();
            using(Graphics desktop = Graphics.FromHwnd(desk))
                mask = DeviceHandle.CreateCompatibleDC(desktop);

            cursorInfoSize = Marshal.SizeOf(typeof(CURSORINFO));
        }
Example #2
0
        public MouseCapture()
        {
            IntPtr desk = PInvoke.GetDesktopWindow();

            using (Graphics desktop = Graphics.FromHwnd(desk))
                mask = DeviceHandle.CreateCompatibleDC(desktop);

            cursorInfoSize = Marshal.SizeOf(typeof(CURSORINFO));
        }
Example #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
         mask.Dispose();
         mask = null;
     }
 }
Example #4
0
        public static DeviceHandle CreateCompatibleDC(Graphics graphics)
        {
            if(graphics == null)
                throw new ArgumentNullException("graphics");

            IntPtr source = graphics.GetHdc();

            IntPtr handle = PInvoke.CreateCompatibleDC(source);
            DeviceHandle dc = new DeviceHandle(handle);

            graphics.ReleaseHdc(source);

            return dc;
        }
Example #5
0
        public static DeviceHandle CreateCompatibleDC(Graphics graphics)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            IntPtr source = graphics.GetHdc();

            IntPtr       handle = PInvoke.CreateCompatibleDC(source);
            DeviceHandle dc     = new DeviceHandle(handle);

            graphics.ReleaseHdc(source);

            return(dc);
        }
Example #6
0
 protected virtual void Dispose(bool disposing)
 {
     if(disposing)
     {
         // free managed resources
         mask.Dispose();
         mask = null;
     }
 }