Beispiel #1
0
        /// <summary>
        ///  Constructor to contruct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(Gdi32.HDC hDC, DeviceContextType dcType)
        {
            _hDC = hDC;
            DeviceContextType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

            if (dcType == DeviceContextType.Display)
            {
                _hWnd = User32.WindowFromDC(this);
            }
        }
Beispiel #2
0
        /// <summary>
        ///  Constructor to contruct a DeviceContext object from an window handle.
        /// </summary>
        private DeviceContext(IntPtr hWnd)
        {
            _hWnd             = hWnd;
            DeviceContextType = 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
        }
Beispiel #3
0
        /// <summary>
        ///  Constructor to contruct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            _hDC = hDC;
            DeviceContextType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

            if (dcType == DeviceContextType.Display)
            {
                _hWnd = User32.WindowFromDC(new HandleRef(this, this._hDC));
            }
        }
Beispiel #4
0
        /// <summary>
        ///  Constructor to contruct a DeviceContext object from an existing Win32 device context handle.
        /// </summary>
        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            _hDC = hDC;
            DeviceContextType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

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