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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Drawing;
  5.     using System.Drawing.Text;
  6.     using System.Windows.Forms;
  7.     internal class x97d171718e5c7e7f : x8917d01b98173f4c
  8.     {
  9.         public x97d171718e5c7e7f(Control control, SkinEngine engine) : base(control, engine)
  10.         {
  11.             if (this.x0e7ffd184973f9bc)
  12.             {
  13.                 uint windowLong = x61467fe65a98f20c.GetWindowLong(base.Handle, -20);
  14.                 if ((windowLong & 0x400000) == 0x400000)
  15.                 {
  16.                     windowLong -= 0x400000;
  17.                 }
  18.                 x61467fe65a98f20c.SetWindowLong(base.Handle, -20, windowLong);
  19.             }
  20.         }
  21.         protected override bool BeforeWndProc(ref Message m)
  22.         {
  23.             switch (((uint) m.Msg))
  24.             {
  25.                 case 15:
  26.                 {
  27.                     x40255b11ef821fa3.PAINTSTRUCT lpPaint = new x40255b11ef821fa3.PAINTSTRUCT();
  28.                     x61467fe65a98f20c.BeginPaint(base.Ctrl.Handle, out lpPaint);
  29.                     this.PaintControl();
  30.                     x61467fe65a98f20c.EndPaint(base.Ctrl.Handle, ref lpPaint);
  31.                     return false;
  32.                 }
  33.                 case 0x84:
  34.                     if (this.x0e7ffd184973f9bc)
  35.                     {
  36.                         int num = m.LParam.ToInt32();
  37.                         Point p = new Point(num & 0xffff, num >> 0x10);
  38.                         p = base.Ctrl.PointToClient(p);
  39.                         p.X = base.Ctrl.Width - p.X;
  40.                         p = base.Ctrl.PointToScreen(p);
  41.                         num = p.X + (p.Y << 0x10);
  42.                         m.LParam = new IntPtr(num);
  43.                     }
  44.                     break;
  45.                 case 0x201:
  46.                     if (this.x0e7ffd184973f9bc)
  47.                     {
  48.                         int num2 = m.LParam.ToInt32();
  49.                         num2 = ((base.Ctrl.Width - num2) & 0xffff) + (num2 & 0xfff0000);
  50.                         m.LParam = new IntPtr(num2);
  51.                     }
  52.                     break;
  53.             }
  54.             return base.BeforeWndProc(ref m);
  55.         }
  56.         protected override void OnCurrentSkinChanged(object sender, SkinChangedEventArgs e)
  57.         {
  58.             base.OnCurrentSkinChanged(sender, e);
  59.             if (!base.CanPaint)
  60.             {
  61.                 if (this.x0e7ffd184973f9bc)
  62.                 {
  63.                     uint dwNewLong = x61467fe65a98f20c.GetWindowLong(base.Handle, -20) & 0x400000;
  64.                     x61467fe65a98f20c.SetWindowLong(base.Handle, -20, dwNewLong);
  65.                 }
  66.             }
  67.             else if (this.x0e7ffd184973f9bc)
  68.             {
  69.                 uint windowLong = x61467fe65a98f20c.GetWindowLong(base.Handle, -20);
  70.                 if ((windowLong & 0x400000) == 0x400000)
  71.                 {
  72.                     windowLong -= 0x400000;
  73.                 }
  74.                 x61467fe65a98f20c.SetWindowLong(base.Handle, -20, windowLong);
  75.             }
  76.         }
  77.         protected override void PaintControl()
  78.         {
  79.             if (((base.Ctrl.ClientRectangle.Width > 0) && (base.Ctrl.ClientRectangle.Height > 0)) && base.CanPaint)
  80.             {
  81.                 using (Bitmap bitmap = new Bitmap(base.Ctrl.Width, base.Ctrl.Height))
  82.                 {
  83.                     using (Graphics graphics = Graphics.FromImage(bitmap))
  84.                     {
  85.                         this.x8bc95f030953f87b(graphics);
  86.                     }
  87.                     if (this.x0e7ffd184973f9bc)
  88.                     {
  89.                         bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX);
  90.                     }
  91.                     using (Graphics graphics2 = Graphics.FromImage(bitmap))
  92.                     {
  93.                         this.x3bf72114458d67b7(graphics2);
  94.                     }
  95.                     using (Graphics graphics3 = Graphics.FromHwnd(base.Handle))
  96.                     {
  97.                         graphics3.DrawImageUnscaled(bitmap, 0, 0);
  98.                     }
  99.                 }
  100.             }
  101.         }
  102.         private void x3bf72114458d67b7(Graphics x41347a961b838962)
  103.         {
  104.             TabControl ctrl = (TabControl) base.Ctrl;
  105.             StringFormat format = new StringFormat();
  106.             format.FormatFlags = StringFormatFlags.NoWrap;
  107.             format.HotkeyPrefix = HotkeyPrefix.None;
  108.             format.LineAlignment = StringAlignment.Center;
  109.             format.Alignment = StringAlignment.Center;
  110.             int height = base.Engine.Res.TabControlRes.TabLine.Height;
  111.             int width = ctrl.Width;
  112.             for (int i = 0; i < ctrl.TabPages.Count; i++)
  113.             {
  114.                 Brush brush;
  115.                 Image image = null;
  116.                 if ((((ctrl.ImageList != null) && (ctrl.TabPages != null)) && ((ctrl.TabPages.Count > i) && (ctrl.TabPages[i] != null))) && ((ctrl.TabPages[i].ImageIndex >= 0) && (ctrl.ImageList.Images.Count > ctrl.TabPages[i].ImageIndex)))
  117.                 {
  118.                     image = ctrl.ImageList.Images[ctrl.TabPages[i].ImageIndex];
  119.                 }
  120.                 Rectangle tabRect = ctrl.GetTabRect(i);
  121.                 int num4 = 1;
  122.                 switch (ctrl.Alignment)
  123.                 {
  124.                     case TabAlignment.Bottom:
  125.                         tabRect.Y += height;
  126.                         tabRect.Height -= height;
  127.                         if (image == null)
  128.                         {
  129.                             goto Label_03B2;
  130.                         }
  131.                         if (!this.x0e7ffd184973f9bc)
  132.                         {
  133.                             break;
  134.                         }
  135.                         x41347a961b838962.DrawImageUnscaled(image, (width - image.Width) - tabRect.X, tabRect.Y);
  136.                         goto Label_0226;
  137.                     case TabAlignment.Left:
  138.                         tabRect.X += num4;
  139.                         format.FormatFlags = StringFormatFlags.DirectionVertical;
  140.                         tabRect.Width -= height;
  141.                         if (image == null)
  142.                         {
  143.                             goto Label_03B2;
  144.                         }
  145.                         if (!this.x0e7ffd184973f9bc)
  146.                         {
  147.                             goto Label_02B8;
  148.                         }
  149.                         x41347a961b838962.DrawImageUnscaled(image, (width - image.Width) - tabRect.X, (tabRect.Bottom - image.Height) - 3);
  150.                         goto Label_02D8;
  151.                     case TabAlignment.Right:
  152.                         tabRect.X -= num4;
  153.                         tabRect.X += height;
  154.                         tabRect.Width -= height;
  155.                         format.FormatFlags = StringFormatFlags.DirectionVertical;
  156.                         tabRect.Width -= height;
  157.                         if (image == null)
  158.                         {
  159.                             goto Label_03B2;
  160.                         }
  161.                         if (!this.x0e7ffd184973f9bc)
  162.                         {
  163.                             goto Label_036C;
  164.                         }
  165.                         x41347a961b838962.DrawImageUnscaled(image, (width - image.Width) - tabRect.X, tabRect.Y + 3);
  166.                         goto Label_0384;
  167.                     default:
  168.                         tabRect.Y += num4;
  169.                         tabRect.Height -= height;
  170.                         if (image != null)
  171.                         {
  172.                             if (this.x0e7ffd184973f9bc)
  173.                             {
  174.                                 x41347a961b838962.DrawImageUnscaled(image, (width - image.Width) - (tabRect.X + 2), tabRect.Y);
  175.                             }
  176.                             else
  177.                             {
  178.                                 x41347a961b838962.DrawImageUnscaled(image, tabRect.X + 2, tabRect.Y);
  179.                             }
  180.                             tabRect.X += image.Width + 3;
  181.                             tabRect.Width -= image.Width + 3;
  182.                         }
  183.                         goto Label_03B2;
  184.                 }
  185.                 x41347a961b838962.DrawImageUnscaled(image, tabRect.X, tabRect.Y);
  186.             Label_0226:
  187.                 tabRect.X += image.Width;
  188.                 tabRect.Width -= image.Width;
  189.                 goto Label_03B2;
  190.             Label_02B8:
  191.                 x41347a961b838962.DrawImageUnscaled(image, tabRect.X, (tabRect.Bottom - image.Height) - 3);
  192.             Label_02D8:
  193.                 tabRect.Height -= image.Height + 3;
  194.                 goto Label_03B2;
  195.             Label_036C:
  196.                 x41347a961b838962.DrawImageUnscaled(image, tabRect.X, tabRect.Y + 3);
  197.             Label_0384:
  198.                 tabRect.Y += image.Height + 3;
  199.                 tabRect.Height -= image.Height + 3;
  200.             Label_03B2:
  201.                 if (ctrl.SelectedIndex == i)
  202.                 {
  203.                     brush = base.Engine.Res.Brushes.SKIN2_TABCONTROLACTIVEFONTCOLOR;
  204.                 }
  205.                 else
  206.                 {
  207.                     brush = base.Engine.Res.Brushes.SKIN2_TABCONTROLINACTIVEFONTCOLOR;
  208.                 }
  209.                 if (this.x0e7ffd184973f9bc)
  210.                 {
  211.                     tabRect.X = (width - tabRect.X) - tabRect.Width;
  212.                 }
  213.                 x41347a961b838962.DrawString(ctrl.TabPages[i].Text, ctrl.Font, brush, tabRect, format);
  214.                 format.FormatFlags = StringFormatFlags.NoWrap;
  215.             }
  216.         }
  217.         private void x8bc95f030953f87b(Graphics x4b101060f4767186)
  218.         {
  219.             TabControl ctrl = (TabControl) base.Ctrl;
  220.             Brush brush = base.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  221.             x4b101060f4767186.FillRectangle(brush, ctrl.ClientRectangle);
  222.             this.xa7a441e9d4de36b0(x4b101060f4767186);
  223.             for (int i = 0; i < ctrl.TabPages.Count; i++)
  224.             {
  225.                 this.xc33f5f7a18a754cb(x4b101060f4767186, i);
  226.             }
  227.         }
  228.         private void xa7a441e9d4de36b0(Graphics x4b101060f4767186)
  229.         {
  230.             Rectangle rectangle;
  231.             Bitmap bitmap2;
  232.             TabControl ctrl = (TabControl) base.Ctrl;
  233.             Bitmap tabLine = base.Engine.Res.TabControlRes.TabLine;
  234.             switch (ctrl.Alignment)
  235.             {
  236.                 case TabAlignment.Bottom:
  237.                     rectangle = new Rectangle(0, ctrl.DisplayRectangle.Bottom + 2, ctrl.Width, tabLine.Height);
  238.                     bitmap2 = new Bitmap(ctrl.Width, tabLine.Height);
  239.                     break;
  240.                 case TabAlignment.Left:
  241.                     rectangle = new Rectangle((ctrl.DisplayRectangle.X - 2) - tabLine.Height, 0, tabLine.Height, ctrl.Height);
  242.                     bitmap2 = new Bitmap(ctrl.Height, tabLine.Height);
  243.                     break;
  244.                 case TabAlignment.Right:
  245.                     rectangle = new Rectangle(ctrl.DisplayRectangle.Right + 2, 0, tabLine.Height, ctrl.Height);
  246.                     bitmap2 = new Bitmap(ctrl.Height, tabLine.Height);
  247.                     break;
  248.                 default:
  249.                     rectangle = new Rectangle(0, (ctrl.DisplayRectangle.Y - 2) - tabLine.Height, ctrl.Width, tabLine.Height);
  250.                     bitmap2 = new Bitmap(ctrl.Width, tabLine.Height);
  251.                     break;
  252.             }
  253.             using (Graphics graphics = Graphics.FromImage(bitmap2))
  254.             {
  255.                 graphics.DrawImage(tabLine, new Rectangle(0, 0, bitmap2.Width, bitmap2.Height), 0, 0, tabLine.Width, tabLine.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileX);
  256.             }
  257.             switch (ctrl.Alignment)
  258.             {
  259.                 case TabAlignment.Bottom:
  260.                     bitmap2.RotateFlip(RotateFlipType.Rotate180FlipNone);
  261.                     break;
  262.                 case TabAlignment.Left:
  263.                     bitmap2.RotateFlip(RotateFlipType.Rotate270FlipNone);
  264.                     break;
  265.                 case TabAlignment.Right:
  266.                     bitmap2.RotateFlip(RotateFlipType.Rotate90FlipNone);
  267.                     break;
  268.             }
  269.             x4b101060f4767186.DrawImageUnscaled(bitmap2, rectangle);
  270.             bitmap2.Dispose();
  271.             Pen borderPen = base.Engine.Res.TabControlRes.BorderPen;
  272.             switch (ctrl.Alignment)
  273.             {
  274.                 case TabAlignment.Bottom:
  275.                     x4b101060f4767186.DrawLine(borderPen, 0, 0, 0, ctrl.DisplayRectangle.Bottom + 2);
  276.                     x4b101060f4767186.DrawLine(borderPen, 0, 0, ctrl.Width, 0);
  277.                     x4b101060f4767186.DrawLine(borderPen, ctrl.Width - 1, 0, ctrl.Width - 1, ctrl.DisplayRectangle.Bottom + 2);
  278.                     return;
  279.                 case TabAlignment.Left:
  280.                     x4b101060f4767186.DrawLine(borderPen, ctrl.DisplayRectangle.X - 2, 0, ctrl.Width, 0);
  281.                     x4b101060f4767186.DrawLine(borderPen, ctrl.DisplayRectangle.X - 2, ctrl.Height - 1, ctrl.Width, ctrl.Height - 1);
  282.                     x4b101060f4767186.DrawLine(borderPen, ctrl.Width - 1, 0, ctrl.Width - 1, ctrl.Height);
  283.                     return;
  284.                 case TabAlignment.Right:
  285.                     x4b101060f4767186.DrawLine(borderPen, 0, 0, 0, ctrl.Height);
  286.                     x4b101060f4767186.DrawLine(borderPen, 0, 0, ctrl.DisplayRectangle.Right + 2, 0);
  287.                     x4b101060f4767186.DrawLine(borderPen, 0, ctrl.Height - 1, ctrl.DisplayRectangle.Right + 2, ctrl.Height - 1);
  288.                     return;
  289.             }
  290.             x4b101060f4767186.DrawLine(borderPen, 0, ctrl.DisplayRectangle.Y - 2, 0, ctrl.Height);
  291.             x4b101060f4767186.DrawLine(borderPen, 0, ctrl.Height - 1, ctrl.Width, ctrl.Height - 1);
  292.             x4b101060f4767186.DrawLine(borderPen, ctrl.Width - 1, ctrl.DisplayRectangle.Y - 2, ctrl.Width - 1, ctrl.Height);
  293.         }
  294.         private void xc33f5f7a18a754cb(Graphics x41347a961b838962, int x067d6ddeefb41622)
  295.         {
  296.             Bitmap bitmap2;
  297.             int num3;
  298.             TabControl ctrl = (TabControl) base.Ctrl;
  299.             Rectangle tabRect = ctrl.GetTabRect(x067d6ddeefb41622);
  300.             if (ctrl.SelectedIndex == x067d6ddeefb41622)
  301.             {
  302.                 num3 = 0;
  303.             }
  304.             else
  305.             {
  306.                 num3 = 1;
  307.             }
  308.             switch (ctrl.Alignment)
  309.             {
  310.                 case TabAlignment.Left:
  311.                 case TabAlignment.Right:
  312.                     bitmap2 = new Bitmap(tabRect.Height, tabRect.Width);
  313.                     break;
  314.                 default:
  315.                     bitmap2 = new Bitmap(tabRect.Width, tabRect.Height);
  316.                     break;
  317.             }
  318.             using (Graphics graphics = Graphics.FromImage(bitmap2))
  319.             {
  320.                 Bitmap image = base.Engine.Res.TabControlRes.TabImage[num3, 0];
  321.                 Rectangle destRect = new Rectangle(0, 0, image.Width, bitmap2.Height);
  322.                 int right = destRect.Right;
  323.                 graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  324.                 image = base.Engine.Res.TabControlRes.TabImage[num3, 2];
  325.                 destRect = new Rectangle(bitmap2.Width - image.Width, 0, image.Width, bitmap2.Height);
  326.                 int left = destRect.Left;
  327.                 graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  328.                 image = base.Engine.Res.TabControlRes.TabImage[num3, 1];
  329.                 destRect = Rectangle.FromLTRB(right, 0, left, bitmap2.Height);
  330.                 graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  331.                 image = base.Engine.Res.TabControlRes.TabLine;
  332.                 int height = image.Height;
  333.                 Rectangle rectangle2 = new Rectangle(0, 0, image.Width, image.Height);
  334.                 destRect = new Rectangle(0, bitmap2.Height - image.Height, bitmap2.Width, image.Height);
  335.                 graphics.DrawImage(image, destRect, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileX);
  336.             }
  337.             switch (ctrl.Alignment)
  338.             {
  339.                 case TabAlignment.Bottom:
  340.                     bitmap2.RotateFlip(RotateFlipType.Rotate180FlipNone);
  341.                     break;
  342.                 case TabAlignment.Left:
  343.                     bitmap2.RotateFlip(RotateFlipType.Rotate270FlipNone);
  344.                     break;
  345.                 case TabAlignment.Right:
  346.                     bitmap2.RotateFlip(RotateFlipType.Rotate90FlipNone);
  347.                     break;
  348.             }
  349.             x41347a961b838962.DrawImageUnscaled(bitmap2, tabRect.X, tabRect.Y);
  350.             bitmap2.Dispose();
  351.         }
  352.         protected override bool ChangeBackColor
  353.         {
  354.             get
  355.             {
  356.                 return false;
  357.             }
  358.         }
  359.         private bool x0e7ffd184973f9bc
  360.         {
  361.             get
  362.             {
  363.                 TabControl ctrl = (TabControl) base.Ctrl;
  364.                 return (ctrl.RightToLeftLayout && ((ctrl.RightToLeft & RightToLeft.Yes) == RightToLeft.Yes));
  365.             }
  366.         }
  367.     }
  368. }