x1d3c48e32d645589.cs
上传用户:xlxx0122
上传日期:2015-04-24
资源大小:3904k
文件大小:9k
源码类别:

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Drawing;
  5.     using System.Windows.Forms;
  6.     internal class x1d3c48e32d645589 : x2edc3f693fe78d2e
  7.     {
  8.         private xa7ba4c69fc1cad79 x6b0ad9f73c48ad53;
  9.         private BorderStyle xacfbd7a08ba56c78;
  10.         public x1d3c48e32d645589(Control control, SkinEngine engine) : base(control, engine)
  11.         {
  12.             this.x6b0ad9f73c48ad53 = new xa7ba4c69fc1cad79(engine, control);
  13.         }
  14.         protected override void DoInit()
  15.         {
  16.             base.DoInit();
  17.             base.Engine.CurrentSkinChanged += new SkinChanged(this.x11d4d6bec891e7ac);
  18.             ListView ctrl = (ListView) base.Ctrl;
  19.             this.xacfbd7a08ba56c78 = ctrl.BorderStyle;
  20.             if ((this.xacfbd7a08ba56c78 != BorderStyle.None) && base.CanPaint)
  21.             {
  22.                 ctrl.BorderStyle = BorderStyle.FixedSingle;
  23.             }
  24.         }
  25.         protected override void PaintControl()
  26.         {
  27.             base.PaintControl();
  28.         }
  29.         private void x11d4d6bec891e7ac(object xe0292b9ed559da7d, SkinChangedEventArgs xfbf34718e704c6bc)
  30.         {
  31.             if (!base.Ctrl.IsDisposed)
  32.             {
  33.                 ListView ctrl = (ListView) base.Ctrl;
  34.                 if (this.xacfbd7a08ba56c78 != BorderStyle.None)
  35.                 {
  36.                     if (base.CanPaint)
  37.                     {
  38.                         ctrl.BorderStyle = BorderStyle.FixedSingle;
  39.                     }
  40.                     else
  41.                     {
  42.                         ctrl.BorderStyle = this.xacfbd7a08ba56c78;
  43.                     }
  44.                 }
  45.             }
  46.         }
  47.         protected override int BorderWidth
  48.         {
  49.             get
  50.             {
  51.                 return 0;
  52.             }
  53.         }
  54.         protected override bool ChangeBackColor
  55.         {
  56.             get
  57.             {
  58.                 return false;
  59.             }
  60.         }
  61.         protected override bool PaintBorder
  62.         {
  63.             get
  64.             {
  65.                 ListView ctrl = (ListView) base.Ctrl;
  66.                 if (ctrl.BorderStyle == BorderStyle.None)
  67.                 {
  68.                     return false;
  69.                 }
  70.                 return true;
  71.             }
  72.         }
  73.         internal class xa7ba4c69fc1cad79 : NativeWindow
  74.         {
  75.             private Control x246c0c54671f3f3e;
  76.             private StringFormat x5786461d089b10a0;
  77.             private SkinEngine xdc87e2b99332cd4a;
  78.             public xa7ba4c69fc1cad79(SkinEngine engine, Control host)
  79.             {
  80.                 this.xdc87e2b99332cd4a = engine;
  81.                 this.x246c0c54671f3f3e = host;
  82.                 this.x5786461d089b10a0 = new StringFormat();
  83.                 this.x5786461d089b10a0.LineAlignment = StringAlignment.Center;
  84.                 this.x5786461d089b10a0.FormatFlags = StringFormatFlags.NoWrap;
  85.                 if (this.x246c0c54671f3f3e != null)
  86.                 {
  87.                     IntPtr handle = x61467fe65a98f20c.SendMessage(host.Handle, 0x101f, (uint) 0, (uint) 0);
  88.                     if (handle != IntPtr.Zero)
  89.                     {
  90.                         base.AssignHandle(handle);
  91.                     }
  92.                 }
  93.             }
  94.             protected virtual unsafe void PaintHeader()
  95.             {
  96.                 Rectangle lpRect = new Rectangle(0, 0, 0, 0);
  97.                 x61467fe65a98f20c.GetWindowRect(base.Handle, ref lpRect);
  98.                 Point p = new Point(lpRect.X, lpRect.Y);
  99.                 p = this.x246c0c54671f3f3e.PointToClient(p);
  100.                 lpRect.X = p.X;
  101.                 lpRect.Y = p.Y;
  102.                 p = new Point(lpRect.Width, lpRect.Height);
  103.                 p = this.x246c0c54671f3f3e.PointToClient(p);
  104.                 lpRect.Width = p.X - lpRect.X;
  105.                 lpRect.Height = p.Y - lpRect.Y;
  106.                 ListView view = (ListView) this.x246c0c54671f3f3e;
  107.                 IntPtr windowDC = x61467fe65a98f20c.GetWindowDC(base.Handle);
  108.                 using (Graphics graphics = Graphics.FromHdc(windowDC))
  109.                 {
  110.                     int num2 = 0;
  111.                     Font messageFont = x448fd9ab43628c71.GetMessageFont();
  112.                     for (int i = 0; i < view.Columns.Count; i++)
  113.                     {
  114.                         IntPtr wParam = new IntPtr(i);
  115.                         Rectangle rect = new Rectangle(0, 0, 0, 0);
  116.                         Rectangle* rectanglePtr = &rect;
  117.                         IntPtr lParam = new IntPtr((void*) rectanglePtr);
  118.                         x61467fe65a98f20c.SendMessage(base.Handle, 0x1207, wParam, lParam);
  119.                         if (lParam != IntPtr.Zero)
  120.                         {
  121.                             int num3;
  122.                             int num4;
  123.                             rectanglePtr = (Rectangle*) lParam;
  124.                             rect.Width -= rect.X;
  125.                             rect.Height -= rect.Y;
  126.                             graphics.FillRectangle(this.xdc87e2b99332cd4a.Res.Brushes.SKIN2_FORMCOLOR, rect);
  127.                             ColumnHeader header = view.Columns[i];
  128.                             switch (header.TextAlign)
  129.                             {
  130.                                 case HorizontalAlignment.Right:
  131.                                     num3 = (rect.Right - rect.Left) - 6;
  132.                                     num4 = (num3 - ((int) graphics.MeasureString(header.Text, messageFont).Width)) - 2;
  133.                                     if (num4 < 4)
  134.                                     {
  135.                                         num4 = 4;
  136.                                     }
  137.                                     num4 = rect.Left + num4;
  138.                                     this.x5786461d089b10a0.Alignment = StringAlignment.Near;
  139.                                     break;
  140.                                 case HorizontalAlignment.Center:
  141.                                     num4 = rect.Left + 4;
  142.                                     this.x5786461d089b10a0.Alignment = StringAlignment.Center;
  143.                                     break;
  144.                                 default:
  145.                                     num4 = rect.Left + 4;
  146.                                     this.x5786461d089b10a0.Alignment = StringAlignment.Near;
  147.                                     break;
  148.                             }
  149.                             num3 = (rect.Right - rect.Left) - 2;
  150.                             string s = x448fd9ab43628c71.FormatStringWithWidth(graphics, header.Text, messageFont, num3);
  151.                             graphics.DrawString(s, messageFont, this.xdc87e2b99332cd4a.Res.Brushes.SKIN2_CONTROLFONTCOLOR, Rectangle.FromLTRB(num4, rect.Top, rect.Right - 2, rect.Bottom), this.x5786461d089b10a0);
  152.                             using (Pen pen = new Pen(this.xdc87e2b99332cd4a.Res.Brushes.SKIN2_CONTROLBORDERCOLOR))
  153.                             {
  154.                                 if (rect.Right == (num2 + 1))
  155.                                 {
  156.                                     graphics.DrawLine(pen, rect.Right - 2, rect.Top, rect.Right - 2, rect.Left);
  157.                                 }
  158.                                 num2 = rect.Right - 1;
  159.                                 graphics.DrawLine(pen, num2, rect.Top, num2, rect.Bottom);
  160.                             }
  161.                         }
  162.                         if (rect.Right < lpRect.Right)
  163.                         {
  164.                             graphics.FillRectangle(this.xdc87e2b99332cd4a.Res.Brushes.SKIN2_FORMCOLOR, Rectangle.FromLTRB(rect.Right, rect.Top, lpRect.Right, rect.Bottom));
  165.                         }
  166.                         using (Pen pen2 = new Pen(this.xdc87e2b99332cd4a.Res.Brushes.SKIN2_CONTROLBORDERCOLOR))
  167.                         {
  168.                             graphics.DrawLine(pen2, lpRect.Left, lpRect.Bottom - 1, rect.Right, lpRect.Bottom - 1);
  169.                         }
  170.                     }
  171.                 }
  172.                 x61467fe65a98f20c.ReleaseDC(this.x246c0c54671f3f3e.Handle, windowDC);
  173.             }
  174.             protected override void WndProc(ref Message m)
  175.             {
  176.                 if (this.xdc87e2b99332cd4a.RealActive && (m.Msg == 15))
  177.                 {
  178.                     x40255b11ef821fa3.PAINTSTRUCT paintstruct;
  179.                     x61467fe65a98f20c.BeginPaint(base.Handle, out paintstruct);
  180.                     this.PaintHeader();
  181.                     x61467fe65a98f20c.EndPaint(base.Handle, ref paintstruct);
  182.                 }
  183.                 base.WndProc(ref m);
  184.                 if (this.xdc87e2b99332cd4a.RealActive)
  185.                 {
  186.                     switch (((uint) m.Msg))
  187.                     {
  188.                         case 0x1204:
  189.                         case 0x120c:
  190.                             this.PaintHeader();
  191.                             break;
  192.                     }
  193.                 }
  194.             }
  195.         }
  196.     }
  197. }