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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Drawing;
  5.     using System.Windows.Forms;
  6.     internal class x422d5afcba1397d3 : x8917d01b98173f4c
  7.     {
  8.         public x422d5afcba1397d3(Control control, SkinEngine engine) : base(control, engine)
  9.         {
  10.         }
  11.         protected override bool BeforeWndProc(ref Message m)
  12.         {
  13.             if (m.HWnd != base.Ctrl.Handle)
  14.             {
  15.                 return true;
  16.             }
  17.             switch (((uint) m.Msg))
  18.             {
  19.                 case 8:
  20.                     this.PaintControl();
  21.                     return false;
  22.                 case 15:
  23.                 {
  24.                     x40255b11ef821fa3.PAINTSTRUCT lpPaint = new x40255b11ef821fa3.PAINTSTRUCT();
  25.                     x61467fe65a98f20c.BeginPaint(base.Ctrl.Handle, out lpPaint);
  26.                     x61467fe65a98f20c.EndPaint(base.Ctrl.Handle, ref lpPaint);
  27.                     m.Result = IntPtr.Zero;
  28.                     return false;
  29.                 }
  30.                 case 20:
  31.                     m.Result = new IntPtr(1);
  32.                     this.PaintControl();
  33.                     return false;
  34.             }
  35.             return base.BeforeWndProc(ref m);
  36.         }
  37.         protected override void DoInit()
  38.         {
  39.             base.DoInit();
  40.             TrackBar ctrl = (TrackBar) base.Ctrl;
  41.             ctrl.ValueChanged += new EventHandler(this.xf51466e2b7549167);
  42.         }
  43.         protected override void PaintControl()
  44.         {
  45.             if (((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0)) && base.CanPaint)
  46.             {
  47.                 using (Bitmap bitmap = new Bitmap(base.Ctrl.Width, base.Ctrl.Height))
  48.                 {
  49.                     using (Graphics graphics = Graphics.FromImage(bitmap))
  50.                     {
  51.                         this.x8bc95f030953f87b(graphics);
  52.                     }
  53.                     using (Graphics graphics2 = Graphics.FromHwnd(base.Handle))
  54.                     {
  55.                         if (this.x0e7ffd184973f9bc)
  56.                         {
  57.                             bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX);
  58.                         }
  59.                         graphics2.DrawImageUnscaled(bitmap, 0, 0);
  60.                     }
  61.                 }
  62.             }
  63.         }
  64.         private void x86a0b6ee5f4b48be(Graphics x4b101060f4767186, Pen x90279591611601bc, float xc941868c59399d3e, float xaf9a0436a70689de, float x10aaa7cdfa38f254, float xca09b6c2b5b18485, float x0b5a48bb98ab819f)
  65.         {
  66.             while (x10aaa7cdfa38f254 < xca09b6c2b5b18485)
  67.             {
  68.                 x4b101060f4767186.DrawLine(x90279591611601bc, x10aaa7cdfa38f254, xc941868c59399d3e, x10aaa7cdfa38f254, xaf9a0436a70689de);
  69.                 x10aaa7cdfa38f254 += x0b5a48bb98ab819f;
  70.                 if (x10aaa7cdfa38f254 >= xca09b6c2b5b18485)
  71.                 {
  72.                     x4b101060f4767186.DrawLine(x90279591611601bc, xca09b6c2b5b18485, xc941868c59399d3e, xca09b6c2b5b18485, xaf9a0436a70689de);
  73.                 }
  74.             }
  75.         }
  76.         private void x8bc95f030953f87b(Graphics x4b101060f4767186)
  77.         {
  78.             int width;
  79.             int height;
  80.             int num7;
  81.             if (!base.CanPaint)
  82.             {
  83.                 return;
  84.             }
  85.             TrackBar ctrl = (TrackBar) base.Ctrl;
  86.             int num = 10;
  87.             int x = 6;
  88.             int num3 = 7;
  89.             int num4 = 15;
  90.             int num8 = ctrl.Value;
  91.             if ((ctrl.RightToLeft & RightToLeft.Yes) == RightToLeft.Yes)
  92.             {
  93.                 num8 = ctrl.Maximum - ctrl.Value;
  94.             }
  95.             if (ctrl.Orientation == Orientation.Horizontal)
  96.             {
  97.                 width = ctrl.Width;
  98.                 height = ctrl.Height;
  99.             }
  100.             else
  101.             {
  102.                 width = ctrl.Height;
  103.                 height = ctrl.Width;
  104.             }
  105.             Bitmap image = new Bitmap(width, height);
  106.             Rectangle rect = new Rectangle(0, 0, width, height);
  107.             Graphics graphics = Graphics.FromImage(image);
  108.             Brush brush = base.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  109.             graphics.FillRectangle(brush, rect);
  110.             Bitmap bitmap = base.Engine.Res.Bitmaps.SKIN2_TRACKBAR;
  111.             switch (ctrl.TickStyle)
  112.             {
  113.                 case TickStyle.None:
  114.                     num7 = num4 / 2;
  115.                     break;
  116.                 case TickStyle.TopLeft:
  117.                     num7 = num + (num4 / 2);
  118.                     break;
  119.                 case TickStyle.BottomRight:
  120.                     num7 = num4 / 2;
  121.                     break;
  122.                 default:
  123.                     num7 = num + (num4 / 2);
  124.                     break;
  125.             }
  126.             rect = new Rectangle(x, num7, width - (2 * x), bitmap.Height);
  127.             Rectangle destRect = new Rectangle(rect.Left, rect.Top, bitmap.Width / 3, bitmap.Height);
  128.             Rectangle srcRect = new Rectangle(0, 0, bitmap.Width / 3, bitmap.Height);
  129.             graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  130.             destRect = Rectangle.FromLTRB(rect.Right - (bitmap.Width / 3), rect.Top, rect.Right, rect.Bottom);
  131.             srcRect = new Rectangle(bitmap.Width - (bitmap.Width / 3), 0, bitmap.Width / 3, bitmap.Height);
  132.             graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  133.             destRect = Rectangle.FromLTRB(rect.Left + (bitmap.Width / 3), rect.Top, rect.Right - (bitmap.Width / 3), rect.Bottom);
  134.             srcRect = Rectangle.FromLTRB(bitmap.Width / 3, 0, bitmap.Width - (bitmap.Width / 3), bitmap.Height);
  135.             graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  136.             switch (ctrl.TickStyle)
  137.             {
  138.                 case TickStyle.None:
  139.                     bitmap = base.Engine.Res.Bitmaps.SKIN2_TRACKBARSLIDER;
  140.                     num7 = 0;
  141.                     break;
  142.                 case TickStyle.TopLeft:
  143.                     bitmap = base.Engine.Res.Bitmaps.SKIN2_TRACKBARSLIDER_180;
  144.                     num7 = num;
  145.                     break;
  146.                 case TickStyle.BottomRight:
  147.                     bitmap = base.Engine.Res.Bitmaps.SKIN2_TRACKBARSLIDER;
  148.                     num7 = 0;
  149.                     break;
  150.                 default:
  151.                     bitmap = base.Engine.Res.Bitmaps.SKIN2_TRACKBARSLIDER;
  152.                     num7 = num;
  153.                     break;
  154.             }
  155.             if (ctrl.Maximum == ctrl.Minimum)
  156.             {
  157.                 goto Label_04D0;
  158.             }
  159.             destRect = new Rectangle(((((int) ((((width - (2 * x)) - (2 * num3)) * (num8 - ctrl.Minimum)) / ((float) (ctrl.Maximum - ctrl.Minimum)))) - (bitmap.Width / 2)) + x) + num3, num7, bitmap.Width, bitmap.Height);
  160.             srcRect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  161.             graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  162.             Pen pen = new Pen(Color.Black, 1f);
  163.             float num9 = x + num3;
  164.             float num10 = (width - x) - num3;
  165.             float num11 = ((num10 - num9) * ctrl.TickFrequency) / ((float) (ctrl.Maximum - ctrl.Minimum));
  166.             if (num11 > 0f)
  167.             {
  168.                 switch (ctrl.TickStyle)
  169.                 {
  170.                     case TickStyle.None:
  171.                         goto Label_04C9;
  172.                     case TickStyle.TopLeft:
  173.                         num7 = num - 4;
  174.                         if (ctrl.Orientation != Orientation.Vertical)
  175.                         {
  176.                             this.x86a0b6ee5f4b48be(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  177.                         }
  178.                         else
  179.                         {
  180.                             this.xa5b17a677db5a5eb(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  181.                         }
  182.                         goto Label_04C9;
  183.                     case TickStyle.BottomRight:
  184.                         num7 = num4 + 7;
  185.                         if (ctrl.Orientation != Orientation.Vertical)
  186.                         {
  187.                             this.x86a0b6ee5f4b48be(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  188.                         }
  189.                         else
  190.                         {
  191.                             this.xa5b17a677db5a5eb(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  192.                         }
  193.                         goto Label_04C9;
  194.                 }
  195.                 num7 = num - 4;
  196.                 if (ctrl.Orientation == Orientation.Vertical)
  197.                 {
  198.                     this.xa5b17a677db5a5eb(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  199.                 }
  200.                 else
  201.                 {
  202.                     this.x86a0b6ee5f4b48be(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  203.                 }
  204.                 num7 = (num + num4) + 7;
  205.                 if (ctrl.Orientation == Orientation.Vertical)
  206.                 {
  207.                     this.xa5b17a677db5a5eb(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  208.                 }
  209.                 else
  210.                 {
  211.                     this.x86a0b6ee5f4b48be(graphics, pen, (float) num7, (float) (num7 + 3), num9, num10, num11);
  212.                 }
  213.             }
  214.         Label_04C9:
  215.             pen.Dispose();
  216.         Label_04D0:
  217.             if (ctrl.Focused)
  218.             {
  219.                 rect = Rectangle.FromLTRB(ctrl.ClientRectangle.X + 5, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.Right - 5, ctrl.ClientRectangle.Bottom - 5);
  220.                 graphics.DrawRectangle(x448fd9ab43628c71.FocusRectanglePen, rect);
  221.             }
  222.             if (ctrl.Orientation == Orientation.Vertical)
  223.             {
  224.                 image.RotateFlip(RotateFlipType.Rotate270FlipNone);
  225.             }
  226.             x4b101060f4767186.DrawImage(image, 0, 0);
  227.             graphics.Dispose();
  228.             image.Dispose();
  229.         }
  230.         private void xa5b17a677db5a5eb(Graphics x4b101060f4767186, Pen x90279591611601bc, float xc941868c59399d3e, float xaf9a0436a70689de, float x10aaa7cdfa38f254, float xca09b6c2b5b18485, float x0b5a48bb98ab819f)
  231.         {
  232.             while (xca09b6c2b5b18485 > x10aaa7cdfa38f254)
  233.             {
  234.                 x4b101060f4767186.DrawLine(x90279591611601bc, xca09b6c2b5b18485, xc941868c59399d3e, xca09b6c2b5b18485, xaf9a0436a70689de);
  235.                 xca09b6c2b5b18485 -= x0b5a48bb98ab819f;
  236.                 if (xca09b6c2b5b18485 <= x10aaa7cdfa38f254)
  237.                 {
  238.                     x4b101060f4767186.DrawLine(x90279591611601bc, x10aaa7cdfa38f254, xc941868c59399d3e, x10aaa7cdfa38f254, xaf9a0436a70689de);
  239.                 }
  240.             }
  241.         }
  242.         private void xf51466e2b7549167(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  243.         {
  244.             this.PaintControl();
  245.         }
  246.         private bool x0e7ffd184973f9bc
  247.         {
  248.             get
  249.             {
  250.                 TrackBar ctrl = (TrackBar) base.Ctrl;
  251.                 return (ctrl.RightToLeftLayout && ((ctrl.RightToLeft & RightToLeft.Yes) == RightToLeft.Yes));
  252.             }
  253.         }
  254.     }
  255. }