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

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

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

            cursorInfoSize = Marshal.SizeOf(typeof(CURSORINFO));
        }
コード例 #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
         mask.Dispose();
         mask = null;
     }
 }
コード例 #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;
        }
コード例 #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);
        }
コード例 #6
0
 protected virtual void Dispose(bool disposing)
 {
     if(disposing)
     {
         // free managed resources
         mask.Dispose();
         mask = null;
     }
 }