void CreateGraphicsFromNativeHdc(int width, int height)
        {
            win32MemDc = new NativeWin32MemoryDc(width, height, true);
            win32MemDc.PatBlt(NativeWin32MemoryDc.PatBltColor.White);
            win32MemDc.SetBackTransparent(true);
            win32MemDc.SetClipRect(0, 0, width, height);

            this.originalHdc = win32MemDc.DC;
            //--------------
            //set default font and default text color
            this.CurrentFont = new RequestFont("tahoma", 14);
            this.CurrentTextColor = Color.Black;
            //--------------

        }
Пример #2
0
 static WinGdiTextService()
 {
     win32MemDc = new NativeWin32MemoryDc(2, 2);
     whitespace[0] = ' ';
 }
        public override void CloseCanvas()
        {
            if (isDisposed)
            {
                return;
            }
            if (win32MemDc != null)
            {
                win32MemDc.Dispose();
                win32MemDc = null;
            }
            isDisposed = true;

            ReleaseUnManagedResource();
        }
        void ReleaseUnManagedResource()
        {
            if (win32MemDc != null)
            {
                win32MemDc.Dispose();
                win32MemDc = null;
                originalHdc = IntPtr.Zero;
            }

            clipRectStack.Clear();
            currentClipRect = new System.Drawing.Rectangle(0, 0, this.Width, this.Height);
#if DEBUG

            debug_releaseCount++;
#endif
        }
Пример #5
0
 static WinGdiTextService()
 {
     s_en          = Encoding.Default; //use platform's default encoding
     win32MemDc    = new NativeWin32MemoryDc(2, 2);
     whitespace[0] = ' ';
 }