示例#1
0
 protected override void WndProc(ref Message message)
 {
     switch (message.Msg)
     {
         case 15:
         {
             var paintStruct = new PaintStruct();
             var targetDc = NativeMethods.BeginPaint(message.HWnd, ref paintStruct);
             var rectangle = new Rectangle(paintStruct.RcPaint_left, paintStruct.RcPaint_top,
                 paintStruct.RcPaint_right - paintStruct.RcPaint_left,
                 paintStruct.RcPaint_bottom - paintStruct.RcPaint_top);
             if ((rectangle.Width > 0) && (rectangle.Height > 0))
             {
                 using (
                     var graphics = BufferedGraphicsManager.Current.Allocate(targetDc,
                         ClientRectangle))
                 {
                     var hdc = graphics.Graphics.GetHdc();
                     var m = Message.Create(Handle, 0x318, hdc, IntPtr.Zero);
                     DefWndProc(ref m);
                     graphics.Graphics.ReleaseHdc(hdc);
                     graphics.Render();
                 }
             }
             NativeMethods.EndPaint(message.HWnd, ref paintStruct);
             message.Result = IntPtr.Zero;
             return;
         }
         case 20:
             message.Result = (IntPtr) 1;
             return;
     }
     base.WndProc(ref message);
 }
示例#2
0
 public static extern bool EndPaint(IntPtr hWnd, ref PaintStruct paintStruct);
示例#3
0
 public static extern bool EndPaint(IntPtr hWnd, ref PaintStruct paintStruct);
示例#4
0
 public static extern IntPtr BeginPaint(IntPtr hWnd, ref PaintStruct paintStruct);
示例#5
0
 public static extern IntPtr BeginPaint(IntPtr hWnd, ref PaintStruct paintStruct);