Exemplo n.º 1
0
        //
        // object construction API.  Publicly constructable from static methods only.
        //

        /// <devdoc>
        ///     Constructor to contruct a DeviceContext object from an window handle.
        /// </devdoc>
        private DeviceContext(IntPtr hWnd)
        {
            this.hWnd   = hWnd;
            this.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
        }
Exemplo n.º 2
0
        /// <devdoc>
        ///     Constructor to contruct a DeviceContext object from an existing Win32 device context handle.
        /// </devdoc>


        private DeviceContext(IntPtr hDC, DeviceContextType dcType)
        {
            this.hDC    = hDC;
            this.dcType = dcType;

            CacheInitialState();
            DeviceContexts.AddDeviceContext(this);

            if (dcType == DeviceContextType.Display)
            {
                this.hWnd = IntUnsafeNativeMethods.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
        }