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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Drawing;
  6.     using System.Windows.Forms;
  7.     internal class xba6d4b6ba4628dd2 : x2edc3f693fe78d2e
  8.     {
  9.         private Hashtable x4d8ef95511cad1be;
  10.         public xba6d4b6ba4628dd2(Control control, SkinEngine engine) : base(control, engine)
  11.         {
  12.             this.x4d8ef95511cad1be = new Hashtable();
  13.         }
  14.         protected override void DoInit()
  15.         {
  16.             base.DoInit();
  17.             StatusBar ctrl = (StatusBar) base.Ctrl;
  18.             ctrl.DrawItem += new StatusBarDrawItemEventHandler(this.xfb5158b9af0961d6);
  19.             this.x62669b25bbf75a19();
  20.         }
  21.         protected override void OnCurrentSkinChanged(object sender, SkinChangedEventArgs e)
  22.         {
  23.             base.OnCurrentSkinChanged(sender, e);
  24.             this.x62669b25bbf75a19();
  25.         }
  26.         protected override void PaintControl()
  27.         {
  28.             if (((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0)) && base.CanPaint)
  29.             {
  30.                 StatusBar ctrl = (StatusBar) base.Ctrl;
  31.                 Brush brush = base.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  32.                 using (Bitmap bitmap = new Bitmap(ctrl.Width, ctrl.Height))
  33.                 {
  34.                     using (Graphics graphics = Graphics.FromImage(bitmap))
  35.                     {
  36.                         Rectangle rect = new Rectangle(0, 0, ctrl.Width, ctrl.Height);
  37.                         graphics.FillRectangle(brush, rect);
  38.                         if (ctrl.SizingGrip)
  39.                         {
  40.                             this.x3e99179c1c1e8d0c(graphics);
  41.                             rect.Width -= 0x11;
  42.                         }
  43.                         if (!ctrl.ShowPanels)
  44.                         {
  45.                             brush = base.Engine.Res.Brushes.SKIN2_CONTROLFONTCOLOR;
  46.                             Font font = ctrl.Font;
  47.                             if (rect.Width > 0)
  48.                             {
  49.                                 StringFormat format = new StringFormat();
  50.                                 if ((ctrl.RightToLeft & RightToLeft.Yes) == RightToLeft.Yes)
  51.                                 {
  52.                                     format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
  53.                                 }
  54.                                 format.LineAlignment = StringAlignment.Center;
  55.                                 format.FormatFlags |= StringFormatFlags.NoWrap;
  56.                                 graphics.DrawString(ctrl.Text, font, brush, rect, format);
  57.                             }
  58.                         }
  59.                         else
  60.                         {
  61.                             int num = 0;
  62.                             int key = 0;
  63.                             foreach (StatusBarPanel panel in ctrl.Panels)
  64.                             {
  65.                                 ButtonBorderStyle none;
  66.                                 int width = panel.Width;
  67.                                 if (this.x4d8ef95511cad1be.ContainsKey(key) && (this.x4d8ef95511cad1be[key] is int))
  68.                                 {
  69.                                     width = (int) this.x4d8ef95511cad1be[key];
  70.                                 }
  71.                                 brush = base.Engine.Res.Brushes.SKIN2_CONTROLBORDERCOLOR;
  72.                                 int right = num + width;
  73.                                 if (panel.BorderStyle == StatusBarPanelBorderStyle.None)
  74.                                 {
  75.                                     none = ButtonBorderStyle.None;
  76.                                 }
  77.                                 else if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised)
  78.                                 {
  79.                                     none = ButtonBorderStyle.Outset;
  80.                                 }
  81.                                 else
  82.                                 {
  83.                                     none = ButtonBorderStyle.Inset;
  84.                                 }
  85.                                 Rectangle bounds = Rectangle.FromLTRB(num + 1, rect.Top + 1, right, rect.Bottom);
  86.                                 ControlPaint.DrawBorder(graphics, bounds, base.Engine.Res.Colors.SKIN2_CONTROLBORDERCOLOR, none);
  87.                                 brush = base.Engine.Res.Brushes.SKIN2_CONTROLFONTCOLOR;
  88.                                 if (panel.Icon != null)
  89.                                 {
  90.                                     graphics.DrawIcon(panel.Icon, bounds.X + 4, bounds.Top + ((bounds.Height - panel.Icon.Height) / 2));
  91.                                     bounds.X += 6 + panel.Icon.Width;
  92.                                     bounds.Width -= 6 + panel.Icon.Width;
  93.                                 }
  94.                                 if (bounds.Width > 0)
  95.                                 {
  96.                                     StringFormat format2 = new StringFormat();
  97.                                     format2.LineAlignment = StringAlignment.Center;
  98.                                     format2.FormatFlags |= StringFormatFlags.NoWrap;
  99.                                     switch (panel.Alignment)
  100.                                     {
  101.                                         case HorizontalAlignment.Left:
  102.                                             format2.Alignment = StringAlignment.Near;
  103.                                             break;
  104.                                         case HorizontalAlignment.Right:
  105.                                             format2.Alignment = StringAlignment.Far;
  106.                                             break;
  107.                                         case HorizontalAlignment.Center:
  108.                                             format2.Alignment = StringAlignment.Center;
  109.                                             break;
  110.                                     }
  111.                                     graphics.DrawString(panel.Text, ctrl.Font, brush, bounds, format2);
  112.                                 }
  113.                                 num = right;
  114.                                 key++;
  115.                             }
  116.                         }
  117.                     }
  118.                     using (Graphics graphics2 = Graphics.FromHwnd(ctrl.Handle))
  119.                     {
  120.                         graphics2.DrawImageUnscaled(bitmap, 0, 0);
  121.                     }
  122.                 }
  123.             }
  124.         }
  125.         protected void x3e99179c1c1e8d0c(Graphics x4b101060f4767186)
  126.         {
  127.             StatusBar ctrl = (StatusBar) base.Ctrl;
  128.             Rectangle rect = Rectangle.FromLTRB(ctrl.Width - 0x10, ctrl.Height - 15, ctrl.Width - 1, ctrl.Height - 1);
  129.             Brush brush = base.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  130.             x4b101060f4767186.FillRectangle(brush, rect);
  131.             Pen pen = new Pen(Color.FromKnownColor(KnownColor.InactiveCaption), 1f);
  132.             x4b101060f4767186.DrawLine(pen, rect.Left + 1, rect.Bottom, rect.Right, rect.Top);
  133.             x4b101060f4767186.DrawLine(pen, rect.Left + 5, rect.Bottom, rect.Right, rect.Top + 4);
  134.             x4b101060f4767186.DrawLine(pen, rect.Left + 9, rect.Bottom, rect.Right, rect.Top + 8);
  135.             x4b101060f4767186.DrawLine(pen, rect.Left + 13, rect.Bottom, rect.Right, rect.Top + 12);
  136.             if ((ctrl.Height - 15) > 3)
  137.             {
  138.                 rect = Rectangle.FromLTRB(ctrl.Width - 0x10, 3, ctrl.Width - 1, ctrl.Height - 15);
  139.                 x4b101060f4767186.FillRectangle(brush, rect);
  140.             }
  141.             rect = Rectangle.FromLTRB(ctrl.Width - 20, 3, ctrl.Width - 0x10, ctrl.Height - 1);
  142.             x4b101060f4767186.FillRectangle(brush, rect);
  143.             pen.Dispose();
  144.         }
  145.         private void x62669b25bbf75a19()
  146.         {
  147.             StatusBar ctrl = (StatusBar) base.Ctrl;
  148.             if (base.CanPaint)
  149.             {
  150.                 foreach (StatusBarPanel panel in ctrl.Panels)
  151.                 {
  152.                     panel.Style = StatusBarPanelStyle.OwnerDraw;
  153.                 }
  154.             }
  155.             else
  156.             {
  157.                 foreach (StatusBarPanel panel2 in ctrl.Panels)
  158.                 {
  159.                     panel2.Style = StatusBarPanelStyle.Text;
  160.                 }
  161.             }
  162.         }
  163.         private void xfb5158b9af0961d6(object xe0292b9ed559da7d, StatusBarDrawItemEventArgs xedd3aee327ed365e)
  164.         {
  165.             if (this.x4d8ef95511cad1be.ContainsKey(xedd3aee327ed365e.Index))
  166.             {
  167.                 this.x4d8ef95511cad1be[xedd3aee327ed365e.Index] = xedd3aee327ed365e.Bounds.Width;
  168.             }
  169.             else
  170.             {
  171.                 this.x4d8ef95511cad1be.Add(xedd3aee327ed365e.Index, xedd3aee327ed365e.Bounds.Width);
  172.             }
  173.         }
  174.         protected override bool ChangeBackColor
  175.         {
  176.             get
  177.             {
  178.                 return true;
  179.             }
  180.         }
  181.     }
  182. }