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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Drawing;
  6.     using System.Drawing.Drawing2D;
  7.     using System.Drawing.Text;
  8.     using System.Windows.Forms;
  9.     internal class xac9a4b8f6325d7e3 : x8917d01b98173f4c
  10.     {
  11.         private const int x4aac5d4d05a8fbe8 = 2;
  12.         private Hashtable x6d04a76446187b96;
  13.         private const int x7a64d9f3c21462d5 = 13;
  14.         private static StringFormat xae3b2752a89e7464 = new StringFormat();
  15.         private const int xaeefdaeb2a720f7d = 2;
  16.         static xac9a4b8f6325d7e3()
  17.         {
  18.             xae3b2752a89e7464.Alignment = StringAlignment.Center;
  19.             xae3b2752a89e7464.LineAlignment = StringAlignment.Center;
  20.             xae3b2752a89e7464.HotkeyPrefix = HotkeyPrefix.Show;
  21.         }
  22.         public xac9a4b8f6325d7e3(Control control, SkinEngine engine) : base(control, engine)
  23.         {
  24.             this.x6d04a76446187b96 = new Hashtable();
  25.         }
  26.         protected override bool BeforeWndProc(ref Message m)
  27.         {
  28.             switch (((uint) m.Msg))
  29.             {
  30.                 case 5:
  31.                     this.PaintControl();
  32.                     break;
  33.                 case 15:
  34.                     x40255b11ef821fa3.PAINTSTRUCT paintstruct;
  35.                     x61467fe65a98f20c.BeginPaint(base.Ctrl.Handle, out paintstruct);
  36.                     this.PaintControl();
  37.                     x61467fe65a98f20c.EndPaint(base.Ctrl.Handle, ref paintstruct);
  38.                     break;
  39.             }
  40.             return base.BeforeWndProc(ref m);
  41.         }
  42.         protected override void DoInit()
  43.         {
  44.             base.DoInit();
  45.             ToolBar ctrl = (ToolBar) base.Ctrl;
  46.             ctrl.MouseMove += new MouseEventHandler(this.x92735afcf18b3c70);
  47.             ctrl.ButtonDropDown += new ToolBarButtonClickEventHandler(this.x7f302ba563726f8f);
  48.         }
  49.         protected override void PaintControl()
  50.         {
  51.             if (((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0)) && base.CanPaint)
  52.             {
  53.                 ToolBar ctrl = (ToolBar) base.Ctrl;
  54.                 IntPtr windowDC = x61467fe65a98f20c.GetWindowDC(base.Handle);
  55.                 Bitmap image = base.Engine.Res.Bitmaps.SKIN2_TOOLBAR;
  56.                 using (Graphics graphics = Graphics.FromHwnd(base.Handle))
  57.                 {
  58.                     using (Bitmap bitmap2 = new Bitmap(ctrl.Width, ctrl.Height))
  59.                     {
  60.                         using (Graphics graphics2 = Graphics.FromImage(bitmap2))
  61.                         {
  62.                             if (image != null)
  63.                             {
  64.                                 graphics2.DrawImage(image, new Rectangle(0, 0, ctrl.Width, ctrl.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  65.                             }
  66.                             else
  67.                             {
  68.                                 using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, ctrl.Width, ctrl.Height), base.Engine.Res.Colors.SKIN2_TOOLBARSTARTCOLOR, base.Engine.Res.Colors.SKIN2_TOOLBARENDCOLOR, LinearGradientMode.Vertical))
  69.                                 {
  70.                                     graphics2.FillRectangle(brush, 0, 0, ctrl.Width, ctrl.Height);
  71.                                 }
  72.                             }
  73.                             foreach (ToolBarButton button in ctrl.Buttons)
  74.                             {
  75.                                 if (!button.Visible)
  76.                                 {
  77.                                     continue;
  78.                                 }
  79.                                 Rectangle rectangle = button.Rectangle;
  80.                                 if (button.Style == ToolBarButtonStyle.Separator)
  81.                                 {
  82.                                     this.xa8d12864a9092939(graphics2, rectangle, button);
  83.                                     continue;
  84.                                 }
  85.                                 if (button.Style == ToolBarButtonStyle.ToggleButton)
  86.                                 {
  87.                                     if (button.Pushed)
  88.                                     {
  89.                                         this.xa8337c38d02b5c00(graphics2, rectangle, button);
  90.                                     }
  91.                                     else if (base.ctrlMouseState == xb9506a535e31f22a.MouseIn)
  92.                                     {
  93.                                         if (x448fd9ab43628c71.InRect(ctrl.PointToClient(Control.MousePosition), rectangle))
  94.                                         {
  95.                                             this.x721082aab66b93c4(graphics2, rectangle, button);
  96.                                         }
  97.                                         else
  98.                                         {
  99.                                             this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  100.                                         }
  101.                                     }
  102.                                     else if (base.ctrlMouseState == xb9506a535e31f22a.MouseDown)
  103.                                     {
  104.                                         if (x448fd9ab43628c71.InRect(ctrl.PointToClient(Control.MousePosition), rectangle))
  105.                                         {
  106.                                             this.xa8337c38d02b5c00(graphics2, rectangle, button);
  107.                                         }
  108.                                         else
  109.                                         {
  110.                                             this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  111.                                         }
  112.                                     }
  113.                                     else
  114.                                     {
  115.                                         this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  116.                                     }
  117.                                     continue;
  118.                                 }
  119.                                 switch (base.ctrlMouseState)
  120.                                 {
  121.                                     case xb9506a535e31f22a.MouseIn:
  122.                                     {
  123.                                         if (!x448fd9ab43628c71.InRect(ctrl.PointToClient(Control.MousePosition), rectangle))
  124.                                         {
  125.                                             goto Label_02A3;
  126.                                         }
  127.                                         this.x721082aab66b93c4(graphics2, rectangle, button);
  128.                                         continue;
  129.                                     }
  130.                                     case xb9506a535e31f22a.MouseDown:
  131.                                     {
  132.                                         if (!x448fd9ab43628c71.InRect(ctrl.PointToClient(Control.MousePosition), rectangle))
  133.                                         {
  134.                                             break;
  135.                                         }
  136.                                         this.xa8337c38d02b5c00(graphics2, rectangle, button);
  137.                                         continue;
  138.                                     }
  139.                                     default:
  140.                                         goto Label_02B1;
  141.                                 }
  142.                                 this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  143.                                 continue;
  144.                             Label_02A3:
  145.                                 this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  146.                                 continue;
  147.                             Label_02B1:
  148.                                 this.xb30ec7cfdf3e5c19(graphics2, rectangle, button);
  149.                             }
  150.                         }
  151.                         graphics.DrawImageUnscaled(bitmap2, 0, 0);
  152.                     }
  153.                     x61467fe65a98f20c.ReleaseDC(base.Handle, windowDC);
  154.                 }
  155.             }
  156.         }
  157.         private void x721082aab66b93c4(Graphics x4b101060f4767186, Rectangle xb55b340ae3a3e4e0, ToolBarButton x128517d7ded59312)
  158.         {
  159.             if (x128517d7ded59312.Style == ToolBarButtonStyle.DropDownButton)
  160.             {
  161.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, base.Engine.Res.Brushes.SKIN2_TOOLBARONCOLOR, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, true, true, true, x128517d7ded59312);
  162.             }
  163.             else
  164.             {
  165.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, base.Engine.Res.Brushes.SKIN2_TOOLBARONCOLOR, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, true, false, true, x128517d7ded59312);
  166.             }
  167.         }
  168.         private void x7f302ba563726f8f(object xe0292b9ed559da7d, ToolBarButtonClickEventArgs xfbf34718e704c6bc)
  169.         {
  170.             if ((xfbf34718e704c6bc.Button.DropDownMenu != null) && !this.x6d04a76446187b96.ContainsKey(xfbf34718e704c6bc.Button.DropDownMenu.Handle))
  171.             {
  172.                 xa1883d0b59b7005b xadbbb = new xa1883d0b59b7005b(base.Engine, xfbf34718e704c6bc.Button.DropDownMenu);
  173.                 this.x6d04a76446187b96.Add(xfbf34718e704c6bc.Button.DropDownMenu.Handle, xadbbb);
  174.             }
  175.         }
  176.         private void x92735afcf18b3c70(object xe0292b9ed559da7d, MouseEventArgs xfbf34718e704c6bc)
  177.         {
  178.             this.PaintControl();
  179.         }
  180.         private void xa8337c38d02b5c00(Graphics x4b101060f4767186, Rectangle xb55b340ae3a3e4e0, ToolBarButton x128517d7ded59312)
  181.         {
  182.             if (x128517d7ded59312.Style == ToolBarButtonStyle.DropDownButton)
  183.             {
  184.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, true, true, true, x128517d7ded59312);
  185.             }
  186.             else
  187.             {
  188.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, base.Engine.Res.Brushes.SKIN2_TOOLBARDOWNCOLOR, true, false, true, x128517d7ded59312);
  189.             }
  190.         }
  191.         private void xa8d12864a9092939(Graphics x4b101060f4767186, Rectangle xb55b340ae3a3e4e0, ToolBarButton x128517d7ded59312)
  192.         {
  193.             Point point = new Point(xb55b340ae3a3e4e0.X + (xb55b340ae3a3e4e0.Width / 2), xb55b340ae3a3e4e0.Top + 1);
  194.             Point point2 = new Point(xb55b340ae3a3e4e0.X + (xb55b340ae3a3e4e0.Width / 2), xb55b340ae3a3e4e0.Bottom - 1);
  195.             using (Pen pen = new Pen(Color.FromKnownColor(KnownColor.ControlDark), 1f))
  196.             {
  197.                 x4b101060f4767186.DrawLine(pen, point, point2);
  198.             }
  199.         }
  200.         private void xb30ec7cfdf3e5c19(Graphics x4b101060f4767186, Rectangle xb55b340ae3a3e4e0, ToolBarButton x128517d7ded59312)
  201.         {
  202.             if (x128517d7ded59312.Style == ToolBarButtonStyle.DropDownButton)
  203.             {
  204.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, null, null, false, true, false, x128517d7ded59312);
  205.             }
  206.             else
  207.             {
  208.                 this.xc05dfbfc3f35bad9(x4b101060f4767186, xb55b340ae3a3e4e0, null, null, false, false, false, x128517d7ded59312);
  209.             }
  210.         }
  211.         private void xc05dfbfc3f35bad9(Graphics x4b101060f4767186, Rectangle xb55b340ae3a3e4e0, Brush x4a36d7ee5781ce75, Brush x35feaa6e77973c81, bool x96554d34fd74b02c, bool xb223465a379c4c80, bool x5afff747d2706456, ToolBarButton x128517d7ded59312)
  212.         {
  213.             ToolBar ctrl = (ToolBar) base.Ctrl;
  214.             Image image = null;
  215.             int width = 0;
  216.             int height = 0;
  217.             if (ctrl.ImageList != null)
  218.             {
  219.                 width = ctrl.ImageList.ImageSize.Width;
  220.                 height = ctrl.ImageList.ImageSize.Height;
  221.                 if ((ctrl.ImageList.Images.Count >= (x128517d7ded59312.ImageIndex + 1)) && (x128517d7ded59312.ImageIndex != -1))
  222.                 {
  223.                     image = ctrl.ImageList.Images[x128517d7ded59312.ImageIndex];
  224.                 }
  225.             }
  226.             if (x96554d34fd74b02c && x128517d7ded59312.Enabled)
  227.             {
  228.                 x4b101060f4767186.FillRectangle(x4a36d7ee5781ce75, xb55b340ae3a3e4e0);
  229.             }
  230.             if (x128517d7ded59312.PartialPush)
  231.             {
  232.                 x4b101060f4767186.FillRectangle(Brushes.WhiteSmoke, xb55b340ae3a3e4e0);
  233.             }
  234.             if (x5afff747d2706456 && x128517d7ded59312.Enabled)
  235.             {
  236.                 using (Pen pen = new Pen(base.Engine.Res.Colors.SKIN2_TOOLBARBORDERCOLOR))
  237.                 {
  238.                     x4b101060f4767186.DrawRectangle(pen, xb55b340ae3a3e4e0.X, xb55b340ae3a3e4e0.Y, xb55b340ae3a3e4e0.Width - 2, xb55b340ae3a3e4e0.Height - 2);
  239.                 }
  240.             }
  241.             if (image != null)
  242.             {
  243.                 if (ctrl.TextAlign == ToolBarTextAlign.Right)
  244.                 {
  245.                     if (x128517d7ded59312.Enabled)
  246.                     {
  247.                         x4b101060f4767186.DrawImageUnscaled(image, 2 + xb55b340ae3a3e4e0.X, xb55b340ae3a3e4e0.Y + ((xb55b340ae3a3e4e0.Height - image.Height) / 2));
  248.                     }
  249.                     else if (x128517d7ded59312.PartialPush)
  250.                     {
  251.                         ControlPaint.DrawImageDisabled(x4b101060f4767186, image, 2 + xb55b340ae3a3e4e0.X, xb55b340ae3a3e4e0.Y + ((xb55b340ae3a3e4e0.Height - image.Height) / 2), Color.WhiteSmoke);
  252.                     }
  253.                     else
  254.                     {
  255.                         ControlPaint.DrawImageDisabled(x4b101060f4767186, image, 2 + xb55b340ae3a3e4e0.X, xb55b340ae3a3e4e0.Y + ((xb55b340ae3a3e4e0.Height - image.Height) / 2), Color.Gray);
  256.                     }
  257.                 }
  258.                 else if (x128517d7ded59312.Enabled)
  259.                 {
  260.                     x4b101060f4767186.DrawImageUnscaled(image, xb55b340ae3a3e4e0.X + ((xb55b340ae3a3e4e0.Width - image.Width) / 2), 2 + xb55b340ae3a3e4e0.Y);
  261.                 }
  262.                 else if (x128517d7ded59312.PartialPush)
  263.                 {
  264.                     ControlPaint.DrawImageDisabled(x4b101060f4767186, image, xb55b340ae3a3e4e0.X + ((xb55b340ae3a3e4e0.Width - image.Width) / 2), 2 + xb55b340ae3a3e4e0.Y, Color.WhiteSmoke);
  265.                 }
  266.                 else
  267.                 {
  268.                     ControlPaint.DrawImageDisabled(x4b101060f4767186, image, xb55b340ae3a3e4e0.X + ((xb55b340ae3a3e4e0.Width - image.Width) / 2), 2 + xb55b340ae3a3e4e0.Y, Color.Gray);
  269.                 }
  270.             }
  271.             if ((x128517d7ded59312.Text != null) && (x128517d7ded59312.Text != ""))
  272.             {
  273.                 Rectangle rectangle;
  274.                 if (ctrl.TextAlign == ToolBarTextAlign.Right)
  275.                 {
  276.                     if (x128517d7ded59312.Style != ToolBarButtonStyle.DropDownButton)
  277.                     {
  278.                         rectangle = Rectangle.FromLTRB(((xb55b340ae3a3e4e0.X + width) + 2) + 1, xb55b340ae3a3e4e0.Y, xb55b340ae3a3e4e0.Right - 1, xb55b340ae3a3e4e0.Bottom);
  279.                     }
  280.                     else
  281.                     {
  282.                         rectangle = Rectangle.FromLTRB(((xb55b340ae3a3e4e0.X + width) + 2) + 1, xb55b340ae3a3e4e0.Y, (xb55b340ae3a3e4e0.Right - 1) - 13, xb55b340ae3a3e4e0.Bottom);
  283.                     }
  284.                 }
  285.                 else if (x128517d7ded59312.Style != ToolBarButtonStyle.DropDownButton)
  286.                 {
  287.                     rectangle = Rectangle.FromLTRB(xb55b340ae3a3e4e0.X, ((xb55b340ae3a3e4e0.Y + height) + 2) + 1, xb55b340ae3a3e4e0.Right, xb55b340ae3a3e4e0.Bottom);
  288.                 }
  289.                 else
  290.                 {
  291.                     rectangle = Rectangle.FromLTRB(xb55b340ae3a3e4e0.X, ((xb55b340ae3a3e4e0.Y + height) + 2) + 1, (xb55b340ae3a3e4e0.Right - 1) - 13, xb55b340ae3a3e4e0.Bottom);
  292.                 }
  293.                 if (x128517d7ded59312.Enabled && !x128517d7ded59312.PartialPush)
  294.                 {
  295.                     x4b101060f4767186.DrawString(x128517d7ded59312.Text, ctrl.Font, Brushes.Black, rectangle, xae3b2752a89e7464);
  296.                 }
  297.                 else
  298.                 {
  299.                     x4b101060f4767186.DrawString(x128517d7ded59312.Text, ctrl.Font, Brushes.Gray, rectangle, xae3b2752a89e7464);
  300.                 }
  301.             }
  302.             if (xb223465a379c4c80)
  303.             {
  304.                 Rectangle rectangle2 = Rectangle.FromLTRB(xb55b340ae3a3e4e0.Right - 13, xb55b340ae3a3e4e0.Y, xb55b340ae3a3e4e0.Right, xb55b340ae3a3e4e0.Bottom);
  305.                 if (x96554d34fd74b02c && x128517d7ded59312.Enabled)
  306.                 {
  307.                     x4b101060f4767186.FillRectangle(x35feaa6e77973c81, rectangle2.X, rectangle2.Y + 1, rectangle2.Width - 1, rectangle2.Height - 2);
  308.                 }
  309.                 Brush brush = base.Engine.Res.Brushes.SKIN2_TOOLBARBORDERCOLOR;
  310.                 if (x96554d34fd74b02c && x128517d7ded59312.Enabled)
  311.                 {
  312.                     using (Pen pen2 = new Pen(brush, 1f))
  313.                     {
  314.                         x4b101060f4767186.DrawRectangle(pen2, rectangle2.X, rectangle2.Y, rectangle2.Width - 2, rectangle2.Height - 2);
  315.                     }
  316.                 }
  317.                 x448fd9ab43628c71.DrawArrowDown(x4b101060f4767186, (rectangle2.X + (rectangle2.Width / 2)) - 4, (rectangle2.Y + (rectangle2.Height / 2)) - 2, x128517d7ded59312.Enabled);
  318.             }
  319.         }
  320.     }
  321. }