xead0c12c344036e3.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 xead0c12c344036e3 : xbd3f2493841f18a1
  7.     {
  8.         public xead0c12c344036e3(Control control, SkinEngine engine) : base(control, engine)
  9.         {
  10.         }
  11.         protected override void DoInit()
  12.         {
  13.             if (base.Ctrl.CompanyName != "WeifenLuo.WinFormsUI")
  14.             {
  15.                 base.DoInit();
  16.                 base.Ctrl.GotFocus += new EventHandler(this.x903997f2d792df23);
  17.                 base.Ctrl.LostFocus += new EventHandler(this.xe44877363ebb618d);
  18.                 base.Ctrl.Paint += new PaintEventHandler(this.xbd9410cb429a8e67);
  19.             }
  20.         }
  21.         protected override void PaintControl()
  22.         {
  23.             if (((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0)) && base.CanPaint)
  24.             {
  25.                 Graphics graphics = Graphics.FromHwnd(base.Ctrl.Handle);
  26.                 this.x8bc95f030953f87b(graphics);
  27.                 graphics.Dispose();
  28.             }
  29.         }
  30.         private void x6b515e4773b2f185(Graphics x4b101060f4767186, Bitmap x5ce6bc2fb6fe458d)
  31.         {
  32.             x4b101060f4767186.DrawImage(x5ce6bc2fb6fe458d, base.Ctrl.ClientRectangle, base.Ctrl.ClientRectangle, GraphicsUnit.Pixel);
  33.         }
  34.         private void x6b515e4773b2f185(Graphics x4b101060f4767186, Bitmap x5ce6bc2fb6fe458d, string x1c2743f354837549, Font x26094932cf7a9139, Rectangle x59dcf7372713ec60)
  35.         {
  36.             Brush gray = null;
  37.             x4b101060f4767186.DrawImage(x5ce6bc2fb6fe458d, base.Ctrl.ClientRectangle, base.Ctrl.ClientRectangle, GraphicsUnit.Pixel);
  38.             if ((x1c2743f354837549 != null) && (x1c2743f354837549 != ""))
  39.             {
  40.                 if (!base.Ctrl.Enabled)
  41.                 {
  42.                     gray = Brushes.Gray;
  43.                 }
  44.                 else
  45.                 {
  46.                     gray = new SolidBrush(base.Ctrl.ForeColor);
  47.                 }
  48.                 if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  49.                 {
  50.                     x448fd9ab43628c71.OffsetRect(ref x59dcf7372713ec60, 1, 1);
  51.                 }
  52.                 x4b101060f4767186.DrawString(x1c2743f354837549, x26094932cf7a9139, gray, x59dcf7372713ec60);
  53.             }
  54.             if ((gray != null) && base.Ctrl.Enabled)
  55.             {
  56.                 gray.Dispose();
  57.             }
  58.         }
  59.         private void x6f37a3496a324cf4(Graphics x4b101060f4767186)
  60.         {
  61.             Rectangle clientRectangle;
  62.             Rectangle rectangle2;
  63.             StringFormat format;
  64.             Brush gray;
  65.             Button ctrl = (Button) base.Ctrl;
  66.             string text = ctrl.Text;
  67.             Image image = ctrl.Image;
  68.             if (image == null)
  69.             {
  70.                 clientRectangle = ctrl.ClientRectangle;
  71.             }
  72.             else
  73.             {
  74.                 switch (ctrl.TextImageRelation)
  75.                 {
  76.                     case TextImageRelation.ImageBeforeText:
  77.                         clientRectangle = Rectangle.FromLTRB(image.Width + 8, 0, ctrl.ClientRectangle.Right, ctrl.ClientRectangle.Height);
  78.                         goto Label_012E;
  79.                     case TextImageRelation.TextBeforeImage:
  80.                     {
  81.                         float width = ctrl.ClientRectangle.Width;
  82.                         float num2 = (int) x4b101060f4767186.MeasureString(ctrl.Text, ctrl.Font).Width;
  83.                         float num3 = image.Width;
  84.                         if ((num2 + num3) >= width)
  85.                         {
  86.                             clientRectangle = Rectangle.FromLTRB(0, 0, (ctrl.ClientRectangle.Width - 8) - image.Width, ctrl.ClientRectangle.Height);
  87.                         }
  88.                         else
  89.                         {
  90.                             clientRectangle = Rectangle.FromLTRB(0, 0, (int) ((width * num2) / (num2 + num3)), ctrl.ClientRectangle.Height);
  91.                         }
  92.                         goto Label_012E;
  93.                     }
  94.                 }
  95.                 clientRectangle = ctrl.ClientRectangle;
  96.             }
  97.         Label_012E:
  98.             x448fd9ab43628c71.CalcLayoutRect(ctrl.TextAlign, clientRectangle, ctrl.RightToLeft, out rectangle2, out format);
  99.             if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  100.             {
  101.                 x448fd9ab43628c71.OffsetRect(ref rectangle2, 1, 1);
  102.             }
  103.             if (base.Ctrl.Enabled)
  104.             {
  105.                 gray = base.Engine.Res.Brushes.SKIN2_BUTTONFONTCOLOR;
  106.             }
  107.             else
  108.             {
  109.                 gray = Brushes.Gray;
  110.             }
  111.             x4b101060f4767186.DrawString(ctrl.Text, ctrl.Font, gray, rectangle2, format);
  112.         }
  113.         private void x8bc95f030953f87b(Graphics x4b101060f4767186)
  114.         {
  115.             if ((base.ctrlMouseState == xb9506a535e31f22a.MouseIn) && !x448fd9ab43628c71.InRect(base.Ctrl.PointToClient(Control.MousePosition), base.Ctrl.ClientRectangle))
  116.             {
  117.                 base.ctrlMouseState = xb9506a535e31f22a.None;
  118.             }
  119.             int ctrlMouseState = (int) base.ctrlMouseState;
  120.             Bitmap src = base.Engine.Res.SplitBitmaps.SKIN2_BUTTON[ctrlMouseState];
  121.             using (Bitmap bitmap2 = new Bitmap(base.Ctrl.Width, base.Ctrl.Height))
  122.             {
  123.                 using (Graphics graphics = Graphics.FromImage(bitmap2))
  124.                 {
  125.                     Brush brush = base.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  126.                     graphics.FillRectangle(brush, base.Ctrl.ClientRectangle);
  127.                     x448fd9ab43628c71.SplitDraw(src, graphics, base.Ctrl.ClientRectangle);
  128.                     if (((Button) base.Ctrl).Image != null)
  129.                     {
  130.                         this.xcea9a0eaf0e83f21(graphics);
  131.                     }
  132.                     if ((base.Ctrl.Text != null) && (base.Ctrl.Text != ""))
  133.                     {
  134.                         this.x6f37a3496a324cf4(graphics);
  135.                     }
  136.                     if (base.Ctrl.Focused)
  137.                     {
  138.                         Rectangle rect = Rectangle.FromLTRB(base.Ctrl.ClientRectangle.Left + 4, base.Ctrl.ClientRectangle.Top + 4, base.Ctrl.ClientRectangle.Right - 5, base.Ctrl.ClientRectangle.Bottom - 5);
  139.                         if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  140.                         {
  141.                             x448fd9ab43628c71.OffsetRect(ref rect, 1, 1);
  142.                         }
  143.                         graphics.DrawRectangle(x448fd9ab43628c71.FocusRectanglePen, rect);
  144.                     }
  145.                     this.x6b515e4773b2f185(x4b101060f4767186, bitmap2);
  146.                 }
  147.             }
  148.         }
  149.         private void x903997f2d792df23(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  150.         {
  151.             if (base.CanPaint)
  152.             {
  153.                 this.PaintControl();
  154.             }
  155.         }
  156.         private void xbd9410cb429a8e67(object xe0292b9ed559da7d, PaintEventArgs xfbf34718e704c6bc)
  157.         {
  158.             if (base.CanPaint)
  159.             {
  160.                 this.x8bc95f030953f87b(xfbf34718e704c6bc.Graphics);
  161.             }
  162.         }
  163.         private void xcea9a0eaf0e83f21(Graphics x4b101060f4767186)
  164.         {
  165.             Button ctrl = (Button) base.Ctrl;
  166.             Image image = ctrl.Image;
  167.             if ((image.Height > 0) && (image.Width > 0))
  168.             {
  169.                 Rectangle clientRectangle;
  170.                 switch (ctrl.TextImageRelation)
  171.                 {
  172.                     case TextImageRelation.ImageBeforeText:
  173.                         clientRectangle = new Rectangle(0, 0, image.Width + 8, ctrl.ClientRectangle.Height);
  174.                         break;
  175.                     case TextImageRelation.TextBeforeImage:
  176.                     {
  177.                         float width = ctrl.ClientRectangle.Width;
  178.                         float num2 = (int) x4b101060f4767186.MeasureString(ctrl.Text, ctrl.Font).Width;
  179.                         float num3 = image.Width;
  180.                         if ((num2 + num3) >= width)
  181.                         {
  182.                             clientRectangle = Rectangle.FromLTRB((ctrl.ClientRectangle.Width - 8) - image.Width, 0, ctrl.ClientRectangle.Width, ctrl.ClientRectangle.Height);
  183.                         }
  184.                         else
  185.                         {
  186.                             clientRectangle = Rectangle.FromLTRB((int) ((width * num2) / (num2 + num3)), 0, ctrl.ClientRectangle.Width, ctrl.ClientRectangle.Height);
  187.                         }
  188.                         break;
  189.                     }
  190.                     default:
  191.                         clientRectangle = ctrl.ClientRectangle;
  192.                         break;
  193.                 }
  194.                 Rectangle rect = x448fd9ab43628c71.CalcLayoutRect(ctrl.ImageAlign, ctrl.RightToLeft, clientRectangle, image.Width, image.Height, 6);
  195.                 if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  196.                 {
  197.                     x448fd9ab43628c71.OffsetRect(ref rect, 1, 1);
  198.                 }
  199.                 x4b101060f4767186.DrawImage(image, rect.X, rect.Y, image.Width, image.Height);
  200.             }
  201.         }
  202.         private void xe44877363ebb618d(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  203.         {
  204.             if (base.CanPaint)
  205.             {
  206.                 this.PaintControl();
  207.             }
  208.         }
  209.     }
  210. }