123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- using Microsoft.Win32;
- namespace Microsoft.Windows.Forms
- {
-
-
-
- public static class PaintManager
- {
-
-
-
-
-
- public static void OnPaint(IUIWindow window, PaintEventArgs e)
- {
-
- if (!window.DoubleBufferedGraphics.Prepare())
- return;
-
- Rectangle clip = e.ClipRectangle;
- using (PaintEventArgs b = new PaintEventArgs(window.DoubleBufferedGraphics.Graphics, window.ClientRectangle))
- {
- window.DoubleBufferedGraphics.Graphics.SetClip(clip, CombineMode.Replace);
- window.RenderCore(b);
- }
-
- e.Graphics.SetClip(clip, CombineMode.Replace);
- window.DoubleBufferedGraphics.Render(e);
- }
-
-
-
-
- public static void WmPaint(ref Message m)
- {
-
- UnsafeNativeMethods.ValidateRect(m.HWnd, IntPtr.Zero);
- }
-
-
-
-
-
- public static void WmPaint(IUIWindow window, ref Message m)
- {
- WmPaint(window, ref m, null);
- }
-
-
-
-
-
-
- public static void WmPaint(IUIWindow window, ref Message m, PaintEventArgs e)
- {
-
- IntPtr hWnd = m.HWnd;
- NativeMethods.PAINTSTRUCT ps = new NativeMethods.PAINTSTRUCT();
- IntPtr hDC = UnsafeNativeMethods.BeginPaint(hWnd, ref ps);
-
- try
- {
- if (e == null)
- {
- using (Graphics g = Graphics.FromHdcInternal(hDC))
- {
- using (e = new PaintEventArgs(g, Rectangle.FromLTRB(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom)))
- {
- OnPaint(window, e);
- }
- }
- }
- else
- {
- OnPaint(window, e);
- }
- }
- finally
- {
-
- UnsafeNativeMethods.EndPaint(hWnd, ref ps);
- }
- }
- }
- }
|