コード例 #1
0
 private DeviceContext(IntPtr hWnd)
 {
     this.hWnd   = (IntPtr)(-1);
     this.hWnd   = hWnd;
     this.dcType = System.Drawing.Internal.DeviceContextType.Display;
     DeviceContexts.AddDeviceContext(this);
 }
コード例 #2
0
        /// <summary>
        /// Constructor to construct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            _hDC    = hDC;
            _dcType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

#if TRACK_HDC
            Debug.WriteLine(DbgUtil.StackTraceToStr($"DeviceContext(hDC=0x{(int)hDC:X8}, Type={dcType})"));
#endif
        }
コード例 #3
0
 private DeviceContext(IntPtr hDC, System.Drawing.Internal.DeviceContextType dcType)
 {
     this.hWnd   = (IntPtr)(-1);
     this.hDC    = hDC;
     this.dcType = dcType;
     this.CacheInitialState();
     DeviceContexts.AddDeviceContext(this);
     if (dcType == System.Drawing.Internal.DeviceContextType.Display)
     {
         this.hWnd = IntUnsafeNativeMethods.WindowFromDC(new HandleRef(this, this.hDC));
     }
 }
コード例 #4
0
        /// <summary>
        /// Constructor to construct a DeviceContext object from an window handle.
        /// </summary>
        private DeviceContext(IntPtr hWnd)
        {
            _hWnd   = hWnd;
            _dcType = DeviceContextType.Display;

            DeviceContexts.AddDeviceContext(this);

            // the hDc will be created on demand.

#if TRACK_HDC
            Debug.WriteLine(DbgUtil.StackTraceToStr(string.Format("DeviceContext( hWnd=0x{0:x8} )", unchecked ((int)hWnd))));
#endif
        }
コード例 #5
0
        /// <summary>
        /// Constructor to construct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            _hDC    = hDC;
            _dcType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

            if (dcType == DeviceContextType.Display)
            {
                _hWnd = IntUnsafeNativeMethods.WindowFromDC(new HandleRef(this, _hDC));
            }
#if TRACK_HDC
            Debug.WriteLine(DbgUtil.StackTraceToStr(string.Format("DeviceContext( hDC=0x{0:X8}, Type={1} )", unchecked ((int)hDC), dcType)));
#endif
        }
コード例 #6
0
ファイル: DeviceContext.cs プロジェクト: pgovind/runtime
        /// <summary>
        /// Constructor to construct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            _hDC    = hDC;
            _dcType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

            if (dcType == DeviceContextType.Display)
            {
                _hWnd = Interop.User32.WindowFromDC(new HandleRef(this, _hDC));
            }
#if TRACK_HDC
            Debug.WriteLine(DbgUtil.StackTraceToStr($"DeviceContext(hDC=0x{(int)hDC:X8}, Type={dcType})"));
#endif
        }