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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Drawing;
  5.     using System.Windows.Forms;
  6.     internal class x896bb4cf7b29301a : xbd3f2493841f18a1
  7.     {
  8.         public x896bb4cf7b29301a(Control control, SkinEngine engine) : base(control, engine)
  9.         {
  10.         }
  11.         protected override void DoInit()
  12.         {
  13.             base.DoInit();
  14.             CheckBox ctrl = (CheckBox) base.Ctrl;
  15.             ctrl.CheckedChanged += new EventHandler(this.x1dba4f67a1b5a3fb);
  16.             ctrl.Click += new EventHandler(this.xf0204c2f26f9917d);
  17.             ctrl.Paint += new PaintEventHandler(this.x6d90c2026f9061d8);
  18.         }
  19.         protected override void PaintControl()
  20.         {
  21.             if ((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0))
  22.             {
  23.                 Graphics graphics = Graphics.FromHwnd(base.Ctrl.Handle);
  24.                 this.x8bc95f030953f87b(graphics);
  25.                 graphics.Dispose();
  26.             }
  27.         }
  28.         private void x1dba4f67a1b5a3fb(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  29.         {
  30.             if (base.CanPaint)
  31.             {
  32.                 this.PaintControl();
  33.             }
  34.         }
  35.         private void x6d90c2026f9061d8(object xe0292b9ed559da7d, PaintEventArgs xfbf34718e704c6bc)
  36.         {
  37.             if (base.CanPaint)
  38.             {
  39.                 this.x8bc95f030953f87b(xfbf34718e704c6bc.Graphics);
  40.             }
  41.         }
  42.         private void x6f37a3496a324cf4(Graphics x4b101060f4767186, int x43abf768b4ac7ff4)
  43.         {
  44.             Rectangle rectangle;
  45.             StringFormat format;
  46.             Brush gray;
  47.             CheckBox ctrl = (CheckBox) base.Ctrl;
  48.             x448fd9ab43628c71.CalcLayoutRect(ctrl.TextAlign, ctrl.ClientRectangle, ctrl.RightToLeft, out rectangle, out format);
  49.             if ((ctrl.RightToLeft & RightToLeft.Yes) != RightToLeft.Yes)
  50.             {
  51.                 switch (ctrl.CheckAlign)
  52.                 {
  53.                     case ContentAlignment.TopLeft:
  54.                     case (ContentAlignment.TopCenter | ContentAlignment.TopLeft):
  55.                     case ContentAlignment.MiddleLeft:
  56.                         goto Label_0134;
  57.                     case ContentAlignment.TopCenter:
  58.                     case ContentAlignment.MiddleCenter:
  59.                     case ContentAlignment.BottomCenter:
  60.                         goto Label_0163;
  61.                     case ContentAlignment.TopRight:
  62.                     case ContentAlignment.MiddleRight:
  63.                     case ContentAlignment.BottomRight:
  64.                         rectangle.Width -= x43abf768b4ac7ff4;
  65.                         goto Label_0163;
  66.                 }
  67.             }
  68.             else
  69.             {
  70.                 switch (ctrl.CheckAlign)
  71.                 {
  72.                     case ContentAlignment.TopCenter:
  73.                     case ContentAlignment.MiddleCenter:
  74.                     case ContentAlignment.BottomCenter:
  75.                         goto Label_0163;
  76.                     case ContentAlignment.TopRight:
  77.                     case ContentAlignment.MiddleRight:
  78.                     case ContentAlignment.BottomRight:
  79.                         rectangle.X += x43abf768b4ac7ff4;
  80.                         rectangle.Width -= x43abf768b4ac7ff4;
  81.                         goto Label_0163;
  82.                 }
  83.                 rectangle.Width -= x43abf768b4ac7ff4;
  84.                 goto Label_0163;
  85.             }
  86.         Label_0134:
  87.             rectangle.X += x43abf768b4ac7ff4;
  88.             rectangle.Width -= x43abf768b4ac7ff4;
  89.         Label_0163:
  90.             if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  91.             {
  92.                 x448fd9ab43628c71.OffsetRect(ref rectangle, 1, 1);
  93.             }
  94.             if (base.Ctrl.Enabled)
  95.             {
  96.                 gray = new SolidBrush(base.Ctrl.ForeColor);
  97.             }
  98.             else
  99.             {
  100.                 gray = Brushes.Gray;
  101.             }
  102.             x4b101060f4767186.DrawString(ctrl.Text, ctrl.Font, gray, rectangle, format);
  103.             if (ctrl.Focused)
  104.             {
  105.                 x4b101060f4767186.DrawRectangle(x448fd9ab43628c71.FocusRectanglePen, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
  106.             }
  107.             if (base.Ctrl.Enabled && (gray != null))
  108.             {
  109.                 gray.Dispose();
  110.             }
  111.         }
  112.         private void x8bc95f030953f87b(Graphics x4b101060f4767186)
  113.         {
  114.             CheckBox ctrl = (CheckBox) base.Ctrl;
  115.             int index = 0;
  116.             if (ctrl.CheckState == CheckState.Checked)
  117.             {
  118.                 if (ctrl.Enabled)
  119.                 {
  120.                     index = 1;
  121.                 }
  122.                 else
  123.                 {
  124.                     index = 4;
  125.                 }
  126.             }
  127.             else if (ctrl.CheckState == CheckState.Indeterminate)
  128.             {
  129.                 if (ctrl.Enabled)
  130.                 {
  131.                     index = 2;
  132.                 }
  133.                 else
  134.                 {
  135.                     index = 5;
  136.                 }
  137.             }
  138.             else if (ctrl.Enabled)
  139.             {
  140.                 index = 3;
  141.             }
  142.             else
  143.             {
  144.                 index = 6;
  145.             }
  146.             Bitmap image = base.Engine.Res.SplitBitmaps.SKIN2_CHECKBOX[index];
  147.             int num2 = Math.Max(image.Width, 13);
  148.             int height = Math.Max(image.Height, 13);
  149.             num2 = Math.Min(num2, 14);
  150.             height = Math.Min(num2, 14);
  151.             using (Brush brush = new SolidBrush(ctrl.BackColor))
  152.             {
  153.                 Rectangle destRect = x448fd9ab43628c71.CalcLayoutRect(ctrl.CheckAlign, ctrl.RightToLeft, ctrl.ClientRectangle, num2, height, 0, 0);
  154.                 x4b101060f4767186.FillRectangle(brush, ctrl.ClientRectangle);
  155.                 Rectangle srcRect = new Rectangle(0, 0, image.Width, image.Height);
  156.                 x4b101060f4767186.DrawImage(image, destRect, srcRect, GraphicsUnit.Pixel);
  157.                 if (ctrl.Image != null)
  158.                 {
  159.                     this.xcea9a0eaf0e83f21(x4b101060f4767186, num2);
  160.                 }
  161.                 this.x6f37a3496a324cf4(x4b101060f4767186, num2);
  162.             }
  163.         }
  164.         private void xcea9a0eaf0e83f21(Graphics x4b101060f4767186, int x43abf768b4ac7ff4)
  165.         {
  166.             CheckBox ctrl = (CheckBox) base.Ctrl;
  167.             Image image = ctrl.Image;
  168.             if ((image.Height > 0) && (image.Width > 0))
  169.             {
  170.                 Rectangle clientRectangle = ctrl.ClientRectangle;
  171.                 switch (ctrl.CheckAlign)
  172.                 {
  173.                     case ContentAlignment.TopCenter:
  174.                     case ContentAlignment.MiddleCenter:
  175.                     case ContentAlignment.BottomCenter:
  176.                         break;
  177.                     case ContentAlignment.TopRight:
  178.                     case ContentAlignment.MiddleRight:
  179.                     case ContentAlignment.BottomRight:
  180.                         clientRectangle.Width -= x43abf768b4ac7ff4;
  181.                         break;
  182.                     default:
  183.                         clientRectangle.X += x43abf768b4ac7ff4;
  184.                         clientRectangle.Width -= x43abf768b4ac7ff4;
  185.                         break;
  186.                 }
  187.                 Rectangle rect = x448fd9ab43628c71.CalcLayoutRect(ctrl.ImageAlign, ctrl.RightToLeft, clientRectangle, image.Width, image.Height);
  188.                 if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  189.                 {
  190.                     x448fd9ab43628c71.OffsetRect(ref rect, 1, 1);
  191.                 }
  192.                 x4b101060f4767186.DrawImage(image, rect.X, rect.Y, image.Width, image.Height);
  193.             }
  194.         }
  195.         private void xf0204c2f26f9917d(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  196.         {
  197.             if (base.CanPaint)
  198.             {
  199.                 this.PaintControl();
  200.             }
  201.         }
  202.         protected override bool ChangeFontColor
  203.         {
  204.             get
  205.             {
  206.                 return true;
  207.             }
  208.         }
  209.     }
  210. }