Exemplo n.º 1
0
 private void WmNcpaint(ref Message m)
 {
     base.WndProc(ref m);
     checked
     {
         if (this.RenderWithVisualStyles())
         {
             int iPartId = 1;
             int iStateId;
             if (base.Enabled)
             {
                 if (base.ReadOnly)
                 {
                     iStateId = 6;
                 }
                 else
                 {
                     iStateId = 1;
                 }
             }
             else
             {
                 iStateId = 4;
             }
             NativeMethods.RECT rECT;
             NativeMethods.GetWindowRect(base.Handle, out rECT);
             rECT.Right  -= rECT.Left;
             rECT.Bottom -= rECT.Top;
             rECT.Top     = (rECT.Left = 0);
             IntPtr             windowDC = NativeMethods.GetWindowDC(base.Handle);
             NativeMethods.RECT rECT2    = rECT;
             rECT2.Left   += this.borderRect.Left;
             rECT2.Top    += this.borderRect.Top;
             rECT2.Right  -= this.borderRect.Right;
             rECT2.Bottom -= this.borderRect.Bottom;
             NativeMethods.ExcludeClipRect(windowDC, rECT2.Left, rECT2.Top, rECT2.Right, rECT2.Bottom);
             IntPtr hTheme = NativeMethods.OpenThemeData(base.Handle, "EDIT");
             if (NativeMethods.IsThemeBackgroundPartiallyTransparent(hTheme, 1, 1) != 0)
             {
                 NativeMethods.DrawThemeParentBackground(base.Handle, windowDC, ref rECT);
             }
             NativeMethods.DrawThemeBackground(hTheme, windowDC, iPartId, iStateId, ref rECT, IntPtr.Zero);
             NativeMethods.CloseThemeData(hTheme);
             NativeMethods.ReleaseDC(base.Handle, windowDC);
             m.Result = IntPtr.Zero;
         }
     }
 }