Exemple #1
0
        private void PerformWmPaint_WmPrintClient(ref Message m, bool isPaintMessage)
        {
            PAINTSTRUCT paintstruct1;
            RECT        rect1;
            Rectangle   rectangle1;

            paintstruct1 = new PAINTSTRUCT();
            IntPtr ptr1 = (isPaintMessage ? User32.BeginPaint(m.HWnd, ref paintstruct1) : m.WParam);

            rect1 = new RECT();
            User32.GetWindowRect(base.Handle, ref rect1);
            rectangle1 = new Rectangle(0, 0, rect1.right - rect1.left, rect1.bottom - rect1.top);
            using (Graphics graphics1 = Graphics.FromHdc(ptr1))
            {
                Bitmap bitmap1 = new Bitmap(rectangle1.Width, rectangle1.Height);
                using (Graphics graphics2 = Graphics.FromImage(bitmap1))
                    this.PerformPaint(new PaintEventArgs(graphics2, rectangle1));
                graphics1.DrawImageUnscaled(bitmap1, 0, 0);
            }
            if (isPaintMessage)
            {
                User32.EndPaint(m.HWnd, ref paintstruct1);
            }
        }
Exemple #2
0
 internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
Exemple #3
0
 internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
 internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
 internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
 private void PerformWmPaint_WmPrintClient(ref Message m, bool isPaintMessage)
 {
     PAINTSTRUCT paintstruct1;
     RECT rect1;
     Rectangle rectangle1;
     paintstruct1 = new PAINTSTRUCT();
     IntPtr ptr1 = (isPaintMessage ? User32.BeginPaint(m.HWnd, ref paintstruct1) : m.WParam);
     rect1 = new RECT();
     User32.GetWindowRect(base.Handle, ref rect1);
     rectangle1 = new Rectangle(0, 0, rect1.right - rect1.left, rect1.bottom - rect1.top);
     using (Graphics graphics1 = Graphics.FromHdc(ptr1))
     {
         Bitmap bitmap1 = new Bitmap(rectangle1.Width, rectangle1.Height);
         using (Graphics graphics2 = Graphics.FromImage(bitmap1))
             this.PerformPaint(new PaintEventArgs(graphics2, rectangle1));
         graphics1.DrawImageUnscaled(bitmap1, 0, 0);
     }
     if(isPaintMessage)
         User32.EndPaint(m.HWnd, ref paintstruct1);
 }