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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin.InternalControls
  2. {
  3.     using Sunisoft.IrisSkin;
  4.     using System;
  5.     using System.Collections;
  6.     using System.ComponentModel;
  7.     using System.Drawing;
  8.     using System.Drawing.Drawing2D;
  9.     using System.Drawing.Imaging;
  10.     using System.Drawing.Text;
  11.     using System.Runtime.CompilerServices;
  12.     using System.Threading;
  13.     using System.Windows.Forms;
  14.     [ToolboxItem(false)]
  15.     internal class x902c4aee45bfd906 : NativeWindow
  16.     {
  17.         protected static readonly int[,] _position = new int[,] { { 
  18.             2, 1, 0, 1, 2, 3, 3, 5, 4, 4, 2, 6, 5, 5, 1, 10, 
  19.             4, 4, 2, 2, 0, 0
  20.          }, { 
  21.             1, 0, 1, 2, 2, 1, 3, 4, 3, 3, 2, 8, 5, 5, 5, 10, 
  22.             0, 0, 2, 2, 2, 5
  23.          } };
  24.         protected Point aboveScreenPosition;
  25.         protected bool animateFirst;
  26.         protected bool animateIn;
  27.         protected x6fd23f8bad2f3ced animateItem;
  28.         protected x1f5697535eab37b9 animateStyle;
  29.         protected int animateTime;
  30.         protected static int blendSteps = 6;
  31.         protected int borderGap;
  32.         protected x902c4aee45bfd906 childMenu;
  33.         protected Point currentPoint;
  34.         protected Size currentSize;
  35.         protected xdbfa333b4cd503e0 direction;
  36.         protected ArrayList drawCommands;
  37.         protected int excludeOffset;
  38.         protected bool excludeTop;
  39.         protected bool exitLoop;
  40.         protected static int expansionDelay = 0x44c;
  41.         protected int extraSize;
  42.         protected bool highlightInfrequent;
  43.         protected static int imageHeight = 0x10;
  44.         protected static int imageWidth = 0x10;
  45.         protected Point lastMousePosition;
  46.         protected bool layered;
  47.         protected Point leftScreenPosition;
  48.         protected xd53b20b7b4b2a08a menuCommands;
  49.         protected static ImageList menuImages = null;
  50.         protected bool mouseOver;
  51.         protected x3c41176af7e54b01 parentControl;
  52.         protected x902c4aee45bfd906 parentMenu;
  53.         protected bool popupDown;
  54.         protected int popupItem;
  55.         protected bool popupRight;
  56.         protected bool rememberExpansion;
  57.         protected x5f4b657f68f87baa returnCommand;
  58.         protected int returnDir;
  59.         protected Point screenPosition;
  60.         protected static int selectionDelay = 400;
  61.         protected static Bitmap shadowCache = null;
  62.         protected static int shadowCacheHeight = 0;
  63.         protected static int shadowCacheWidth = 0;
  64.         protected static int shadowHalf = 2;
  65.         protected static int shadowLength = 4;
  66.         protected bool showInfrequent;
  67.         protected static bool supportsLayered = false;
  68.         protected System.Drawing.Font textFont;
  69.         protected System.Windows.Forms.Timer timer;
  70.         protected int trackItem;
  71.         protected readonly uint WM_DISMISS = 0x401;
  72.         protected readonly uint WM_OPERATE_SUBMENU = 0x402;
  73.         internal RightToLeft x94975a4c4f1d71c4;
  74.         private SkinEngine xcab6a0e662ada486;
  75.         public event x26569a56dfbc2c6d Deselected;
  76.         public event x26569a56dfbc2c6d Selected;
  77.         static x902c4aee45bfd906()
  78.         {
  79.             menuImages = x58dd58a96343fde0.LoadBitmapStrip(System.Type.GetType("Sunisoft.IrisSkin.SkinEngine"), "Sunisoft.IrisSkin.ImagesPopupMenu.bmp", new Size(0x10, 0x10), new Point(0, 0));
  80.             supportsLayered = OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows) != null;
  81.         }
  82.         public x902c4aee45bfd906(SkinEngine engine)
  83.         {
  84.             this.Engine = engine;
  85.             this.drawCommands = new ArrayList();
  86.             this.menuCommands = new xd53b20b7b4b2a08a();
  87.             this.returnDir = 0;
  88.             this.extraSize = 0;
  89.             this.borderGap = 0;
  90.             this.popupItem = -1;
  91.             this.trackItem = -1;
  92.             this.childMenu = null;
  93.             this.exitLoop = false;
  94.             this.popupDown = true;
  95.             this.mouseOver = false;
  96.             this.excludeTop = true;
  97.             this.popupRight = true;
  98.             this.parentMenu = null;
  99.             this.excludeOffset = 0;
  100.             this.parentControl = null;
  101.             this.returnCommand = null;
  102.             this.highlightInfrequent = false;
  103.             this.showInfrequent = false;
  104.             this.rememberExpansion = true;
  105.             this.lastMousePosition = new Point(-1, -1);
  106.             this.direction = xdbfa333b4cd503e0.Horizontal;
  107.             this.textFont = SystemInformation.MenuFont;
  108.             this.animateTime = 100;
  109.             this.animateItem = x6fd23f8bad2f3ced.System;
  110.             this.animateStyle = x1f5697535eab37b9.System;
  111.             this.animateFirst = true;
  112.             this.animateIn = true;
  113.             this.timer = new System.Windows.Forms.Timer();
  114.             this.timer.Interval = selectionDelay;
  115.             this.timer.Tick += new EventHandler(this.x07cc1c177f7b41bd);
  116.         }
  117.         public void Dismiss()
  118.         {
  119.             if (base.Handle != IntPtr.Zero)
  120.             {
  121.                 this.timer.Stop();
  122.                 if (this.childMenu != null)
  123.                 {
  124.                     this.childMenu.Dismiss();
  125.                 }
  126.                 this.exitLoop = true;
  127.                 this.x4139e66e6dfaac52();
  128.                 x61467fe65a98f20c.PostMessage(base.Handle, this.WM_DISMISS, (uint) 0, (uint) 0);
  129.             }
  130.         }
  131.         public virtual void OnDeselected(x5f4b657f68f87baa mc)
  132.         {
  133.             if (this.parentControl != null)
  134.             {
  135.                 this.parentControl.OnDeselected(mc);
  136.             }
  137.             else if (this.xd42ce0324cbc114a != null)
  138.             {
  139.                 this.xd42ce0324cbc114a(mc);
  140.             }
  141.             else if (this.parentMenu != null)
  142.             {
  143.                 this.parentMenu.OnDeselected(mc);
  144.             }
  145.         }
  146.         public virtual void OnSelected(x5f4b657f68f87baa mc)
  147.         {
  148.             if (this.parentControl != null)
  149.             {
  150.                 this.parentControl.OnSelected(mc);
  151.             }
  152.             else if (this.xaa7558c320af04eb != null)
  153.             {
  154.                 this.xaa7558c320af04eb(mc);
  155.             }
  156.             else if (this.parentMenu != null)
  157.             {
  158.                 this.parentMenu.OnSelected(mc);
  159.             }
  160.         }
  161.         public x5f4b657f68f87baa TrackPopup(Point screenPos)
  162.         {
  163.             return this.TrackPopup(screenPos, false);
  164.         }
  165.         public x5f4b657f68f87baa TrackPopup(Point screenPos, bool selectFirst)
  166.         {
  167.             if (this.menuCommands.VisibleItems())
  168.             {
  169.                 this.direction = xdbfa333b4cd503e0.Horizontal;
  170.                 this.screenPosition = screenPos;
  171.                 this.aboveScreenPosition = screenPos;
  172.                 this.leftScreenPosition = screenPos;
  173.                 return this.x6e4244e25732db7d(selectFirst);
  174.             }
  175.             return null;
  176.         }
  177.         public x5f4b657f68f87baa TrackPopupTaskBar(Point screenPos)
  178.         {
  179.             if (this.menuCommands.VisibleItems())
  180.             {
  181.                 this.direction = xdbfa333b4cd503e0.Horizontal;
  182.                 this.screenPosition = screenPos;
  183.                 this.aboveScreenPosition = screenPos;
  184.                 this.leftScreenPosition = screenPos;
  185.                 return this.xf1c4e2176aec0ad6(false);
  186.             }
  187.             return null;
  188.         }
  189.         protected override void WndProc(ref Message m)
  190.         {
  191.             if (m.Msg == this.WM_DISMISS)
  192.             {
  193.                 this.xb97e8a8020dddaac();
  194.             }
  195.             else if (m.Msg == this.WM_OPERATE_SUBMENU)
  196.             {
  197.                 this.xbcf8eb07b7e76a62(ref m);
  198.             }
  199.             else
  200.             {
  201.                 switch (((uint) m.Msg))
  202.                 {
  203.                     case 0x20:
  204.                         this.x773209141f430902();
  205.                         return;
  206.                     case 0x21:
  207.                         this.x20a824d899eb6cd8(ref m);
  208.                         return;
  209.                     case 0x84:
  210.                         if (this.xddec9c21ef58186c(ref m))
  211.                         {
  212.                             break;
  213.                         }
  214.                         base.WndProc(ref m);
  215.                         return;
  216.                     case 15:
  217.                         this.x038e1503810e39c7(ref m);
  218.                         return;
  219.                     case 0x1c:
  220.                         this.xa68b9c37c0ff7fc5(ref m);
  221.                         return;
  222.                     default:
  223.                         base.WndProc(ref m);
  224.                         break;
  225.                 }
  226.             }
  227.         }
  228.         protected void x038e1503810e39c7(ref Message x6088325dec1baa2a)
  229.         {
  230.             x40255b11ef821fa3.PAINTSTRUCT lpPaint = new x40255b11ef821fa3.PAINTSTRUCT();
  231.             IntPtr hdc = x61467fe65a98f20c.BeginPaint(x6088325dec1baa2a.HWnd, out lpPaint);
  232.             xae4dd1cafd2eb77c.RECT lpRect = new xae4dd1cafd2eb77c.RECT();
  233.             x61467fe65a98f20c.GetWindowRect(base.Handle, ref lpRect);
  234.             Rectangle rectangle = new Rectangle(0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top);
  235.             using (Graphics graphics = Graphics.FromHdc(hdc))
  236.             {
  237.                 Bitmap image = new Bitmap(rectangle.Width, rectangle.Height);
  238.                 using (Graphics graphics2 = Graphics.FromImage(image))
  239.                 {
  240.                     this.x4af0f9e5d7ac184a(graphics2, rectangle);
  241.                     this.x05a10b378cdf8119(graphics2);
  242.                 }
  243.                 graphics.DrawImageUnscaled(image, 0, 0);
  244.             }
  245.             x61467fe65a98f20c.EndPaint(x6088325dec1baa2a.HWnd, ref lpPaint);
  246.         }
  247.         protected void x057464a452da34b7()
  248.         {
  249.             this.drawCommands.Clear();
  250.             this.showInfrequent = true;
  251.             if (this.rememberExpansion)
  252.             {
  253.                 this.menuCommands.ShowInfrequent = true;
  254.             }
  255.             Size size = this.x4e2849ed170f5bc2();
  256.             Point point = this.x6e375ee3ca34b13b(size);
  257.             this.currentPoint = point;
  258.             this.currentSize = size;
  259.             if (!this.layered)
  260.             {
  261.                 this.x1803d70928e3ae9b(size);
  262.                 x61467fe65a98f20c.MoveWindow(base.Handle, point.X, point.Y, size.Width, size.Height, true);
  263.                 xae4dd1cafd2eb77c.RECT lpRect = new xae4dd1cafd2eb77c.RECT();
  264.                 lpRect.left = 0;
  265.                 lpRect.top = 0;
  266.                 lpRect.right = size.Width;
  267.                 lpRect.bottom = size.Height;
  268.                 x61467fe65a98f20c.InvalidateRect(base.Handle, ref lpRect, true);
  269.             }
  270.             else
  271.             {
  272.                 this.x9119fce83e4631ad();
  273.                 this.x95f5f55ee201fb8f();
  274.             }
  275.         }
  276.         protected void x05a10b378cdf8119(Graphics x4b101060f4767186)
  277.         {
  278.             for (int i = 0; i < this.drawCommands.Count; i++)
  279.             {
  280.                 x2cc390e9409b0f3f xccebff = this.drawCommands[i] as x2cc390e9409b0f3f;
  281.                 this.xb5a5bdae3ba8936b(x4b101060f4767186, xccebff, i == this.trackItem);
  282.             }
  283.         }
  284.         protected void x0760506d6abf77a2(int xf624f8e86c5ae5f1, bool xacc37ebdd71fcc44)
  285.         {
  286.             x61467fe65a98f20c.PostMessage(base.Handle, this.WM_OPERATE_SUBMENU, (uint) xf624f8e86c5ae5f1, xacc37ebdd71fcc44 ? 1 : 0);
  287.         }
  288.         protected void x07cc1c177f7b41bd(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  289.         {
  290.             this.timer.Stop();
  291.             bool flag = true;
  292.             if (this.childMenu != null)
  293.             {
  294.                 if (this.popupItem != this.trackItem)
  295.                 {
  296.                     x61467fe65a98f20c.PostMessage(this.childMenu.Handle, this.WM_DISMISS, (uint) 0, (uint) 0);
  297.                 }
  298.                 else
  299.                 {
  300.                     flag = false;
  301.                 }
  302.             }
  303.             if (flag && (this.trackItem != -1))
  304.             {
  305.                 x2cc390e9409b0f3f xccebff = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  306.                 if (xccebff.SubMenu)
  307.                 {
  308.                     this.x0760506d6abf77a2(this.trackItem, false);
  309.                 }
  310.                 else if (xccebff.Expansion)
  311.                 {
  312.                     this.x057464a452da34b7();
  313.                 }
  314.             }
  315.         }
  316.         protected void x0e37e200024f43ba()
  317.         {
  318.             bool flag = (this.parentMenu != null) || (this.parentControl != null);
  319.             bool flag2 = false;
  320.             if (this.trackItem != -1)
  321.             {
  322.                 x2cc390e9409b0f3f xccebff = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  323.                 int col = xccebff.Col;
  324.                 int row = xccebff.Row;
  325.                 if (col > 0)
  326.                 {
  327.                     int num3 = -1;
  328.                     int num4 = -1;
  329.                     int num5 = col - 1;
  330.                     x2cc390e9409b0f3f xccebff2 = null;
  331.                     for (int i = 0; i < this.drawCommands.Count; i++)
  332.                     {
  333.                         x2cc390e9409b0f3f xccebff3 = this.drawCommands[i] as x2cc390e9409b0f3f;
  334.                         if ((((xccebff3.Col == num5) && (xccebff3.Row <= row)) && ((xccebff3.Row > num4) && !xccebff3.Separator)) && xccebff3.Enabled)
  335.                         {
  336.                             num4 = xccebff3.Row;
  337.                             xccebff2 = xccebff3;
  338.                             num3 = i;
  339.                         }
  340.                     }
  341.                     if (xccebff2 != null)
  342.                     {
  343.                         this.xeb515a5b77846afe(this.trackItem, num3, false, false);
  344.                     }
  345.                     else
  346.                     {
  347.                         flag2 = true;
  348.                     }
  349.                 }
  350.                 else
  351.                 {
  352.                     flag2 = true;
  353.                 }
  354.             }
  355.             else if (this.parentMenu != null)
  356.             {
  357.                 if (!this.x5437d760e9a6340b())
  358.                 {
  359.                     flag2 = true;
  360.                 }
  361.             }
  362.             else
  363.             {
  364.                 flag2 = true;
  365.             }
  366.             if (flag && flag2)
  367.             {
  368.                 this.returnCommand = null;
  369.                 this.timer.Stop();
  370.                 this.exitLoop = true;
  371.                 if (this.parentMenu == null)
  372.                 {
  373.                     this.returnDir = -1;
  374.                 }
  375.             }
  376.         }
  377.         protected Point x1339f634e34e0e03(Size x001544edc57babc2)
  378.         {
  379.             Screen.GetWorkingArea(this.screenPosition);
  380.             Point screenPosition = this.screenPosition;
  381.             this.excludeTop = true;
  382.             this.excludeOffset = 0;
  383.             x001544edc57babc2.Width -= _position[0, 0x10];
  384.             screenPosition.Y = (screenPosition.Y - x001544edc57babc2.Height) + 3;
  385.             return screenPosition;
  386.         }
  387.         protected void x136735fdfe6d04ea(int x75cf7df8c59ffa4d, int xc13ed6de98262a2d)
  388.         {
  389.             x75cf7df8c59ffa4d -= this.currentPoint.X;
  390.             xc13ed6de98262a2d -= this.currentPoint.Y;
  391.             if (this.parentMenu != null)
  392.             {
  393.                 this.parentMenu.x76a103c0a87eb01c();
  394.             }
  395.             this.mouseOver = true;
  396.             Point pt = new Point(x75cf7df8c59ffa4d, xc13ed6de98262a2d);
  397.             if (this.lastMousePosition != pt)
  398.             {
  399.                 for (int i = 0; i < this.drawCommands.Count; i++)
  400.                 {
  401.                     x2cc390e9409b0f3f xccebff = this.drawCommands[i] as x2cc390e9409b0f3f;
  402.                     if (xccebff.DrawRect.Contains(pt) && (this.trackItem != i))
  403.                     {
  404.                         this.xeb515a5b77846afe(this.trackItem, i, true, false);
  405.                     }
  406.                 }
  407.                 this.lastMousePosition = pt;
  408.             }
  409.         }
  410.         protected void x1803d70928e3ae9b(Size x001544edc57babc2)
  411.         {
  412.             int height = _position[0, 0x11];
  413.             int width = _position[0, 0x10];
  414.             Region region = new Region();
  415.             region.MakeInfinite();
  416.             region.Xor(new Rectangle(x001544edc57babc2.Width - width, 0, width, height));
  417.             if ((this.direction != xdbfa333b4cd503e0.Vertical) || this.excludeTop)
  418.             {
  419.                 region.Xor(new Rectangle(0, x001544edc57babc2.Height - height, width, height));
  420.             }
  421.             using (Graphics graphics = Graphics.FromHwnd(base.Handle))
  422.             {
  423.                 x61467fe65a98f20c.SetWindowRgn(base.Handle, region.GetHrgn(graphics), false);
  424.             }
  425.         }
  426.         protected void x20a824d899eb6cd8(ref Message x6088325dec1baa2a)
  427.         {
  428.             x6088325dec1baa2a.Result = (IntPtr) 3;
  429.         }
  430.         protected bool x277ff37e12aff68b(x555516122dcc901e.POINT x0ce73f6cbd7d5515, ref x40255b11ef821fa3.MSG x8a41fbc87a3fb305)
  431.         {
  432.             if ((x8a41fbc87a3fb305.message == 0x200) && (this.parentControl != null))
  433.             {
  434.                 xae4dd1cafd2eb77c.RECT lpRect = new xae4dd1cafd2eb77c.RECT();
  435.                 x61467fe65a98f20c.GetWindowRect(this.parentControl.Handle, ref lpRect);
  436.                 if (((x0ce73f6cbd7d5515.x >= lpRect.left) && (x0ce73f6cbd7d5515.x <= lpRect.right)) && ((x0ce73f6cbd7d5515.y >= lpRect.top) && (x0ce73f6cbd7d5515.y <= lpRect.bottom)))
  437.                 {
  438.                     return true;
  439.                 }
  440.             }
  441.             return false;
  442.         }
  443.         internal x902c4aee45bfd906 x3c6f7570c20e3f7d(x555516122dcc901e.POINT x0ce73f6cbd7d5515, ref x40255b11ef821fa3.MSG x8a41fbc87a3fb305)
  444.         {
  445.             if (this.parentMenu != null)
  446.             {
  447.                 return this.parentMenu.xcb534454d6825379(x0ce73f6cbd7d5515);
  448.             }
  449.             return null;
  450.         }
  451.         protected void x4139e66e6dfaac52()
  452.         {
  453.             x61467fe65a98f20c.ShowWindow(base.Handle, 0);
  454.         }
  455.         protected void x4af0f9e5d7ac184a(Graphics x4b101060f4767186, Rectangle x3821770539095b42)
  456.         {
  457.             Rectangle rect = new Rectangle(0, 0, (x3821770539095b42.Width - 1) - _position[0, 0x10], (x3821770539095b42.Height - 1) - _position[0, 0x11]);
  458.             int width = (_position[0, 5] + imageWidth) + _position[0, 7];
  459.             int x = _position[0, 1];
  460.             int y = _position[0, 0];
  461.             int height = ((rect.Height - y) - _position[0, 2]) - 1;
  462.             Brush brush = this.Engine.Res.Brushes.SKIN2_MENUITEMCOLOR;
  463.             x4b101060f4767186.FillRectangle(brush, rect);
  464.             brush = this.Engine.Res.Brushes.SKIN2_LEFTBARSTARTCOLOR;
  465.             using (Pen pen = new Pen(ControlPaint.Dark(this.Engine.Res.Colors.SKIN2_MENUITEMCOLOR)))
  466.             {
  467.                 x4b101060f4767186.DrawRectangle(pen, rect);
  468.                 if (this.borderGap > 0)
  469.                 {
  470.                     if (this.direction == xdbfa333b4cd503e0.Horizontal)
  471.                     {
  472.                         if (this.excludeTop)
  473.                         {
  474.                             x4b101060f4767186.FillRectangle(Brushes.White, (rect.Left + 1) + this.excludeOffset, rect.Top, this.borderGap - 1, 1);
  475.                             x4b101060f4767186.FillRectangle(brush, (rect.Left + 1) + this.excludeOffset, rect.Top, this.borderGap - 1, 1);
  476.                         }
  477.                         else
  478.                         {
  479.                             x4b101060f4767186.FillRectangle(Brushes.White, (rect.Left + 1) + this.excludeOffset, rect.Bottom, this.borderGap - 1, 1);
  480.                             x4b101060f4767186.FillRectangle(brush, (rect.Left + 1) + this.excludeOffset, rect.Bottom, this.borderGap - 1, 1);
  481.                         }
  482.                     }
  483.                     else if (this.excludeTop)
  484.                     {
  485.                         x4b101060f4767186.FillRectangle(Brushes.White, rect.Left, (rect.Top + 1) + this.excludeOffset, 1, this.borderGap - 1);
  486.                         x4b101060f4767186.FillRectangle(brush, rect.Left, (rect.Top + 1) + this.excludeOffset, 1, this.borderGap - 1);
  487.                     }
  488.                     else if (this.popupDown)
  489.                     {
  490.                         x4b101060f4767186.FillRectangle(Brushes.White, rect.Left, (rect.Bottom - 1) - this.excludeOffset, 1, this.borderGap - 1);
  491.                         x4b101060f4767186.FillRectangle(brush, rect.Left, (rect.Bottom - 1) - this.excludeOffset, 1, this.borderGap - 1);
  492.                     }
  493.                     else
  494.                     {
  495.                         x4b101060f4767186.FillRectangle(Brushes.White, rect.Left, (rect.Bottom - this.borderGap) + 1, 1, this.borderGap - 1);
  496.                         x4b101060f4767186.FillRectangle(brush, rect.Left, (rect.Bottom - this.borderGap) + 1, 1, this.borderGap - 1);
  497.                     }
  498.                 }
  499.             }
  500.             Rectangle rectangle2 = new Rectangle(x, y, width, height);
  501.             x4b101060f4767186.FillRectangle(Brushes.White, rectangle2);
  502.             x4b101060f4767186.FillRectangle(brush, rectangle2);
  503.             foreach (x2cc390e9409b0f3f xccebff in this.drawCommands)
  504.             {
  505.                 if (xccebff.Separator && xccebff.VerticalSeparator)
  506.                 {
  507.                     rectangle2.X = xccebff.DrawRect.Right;
  508.                     x4b101060f4767186.FillRectangle(Brushes.White, rectangle2);
  509.                     x4b101060f4767186.FillRectangle(brush, rectangle2);
  510.                 }
  511.             }
  512.             int num5 = rect.Right + 1;
  513.             int num6 = rect.Top + _position[0, 0x11];
  514.             int num7 = rect.Bottom + 1;
  515.             int num8 = rect.Left + _position[0, 0x10];
  516.             int num9 = rect.Left + this.excludeOffset;
  517.             int num10 = (rect.Left + this.excludeOffset) + this.borderGap;
  518.             if (((this.borderGap > 0) && !this.excludeTop) && (this.direction == xdbfa333b4cd503e0.Horizontal))
  519.             {
  520.                 int num11 = x3821770539095b42.Width;
  521.                 if (num9 >= num8)
  522.                 {
  523.                     this.xcea282a46787878f(x4b101060f4767186, num8, num7, num9 - num8, _position[0, 0x11], xf398ffaf32ffe055.Left);
  524.                 }
  525.                 if (num10 <= num11)
  526.                 {
  527.                     this.xcea282a46787878f(x4b101060f4767186, num10, num7, num11 - num10, _position[0, 0x11], xf398ffaf32ffe055.Right);
  528.                 }
  529.             }
  530.             else
  531.             {
  532.                 if ((this.direction == xdbfa333b4cd503e0.Vertical) && !this.excludeTop)
  533.                 {
  534.                     num8 = 0;
  535.                 }
  536.                 this.xcea282a46787878f(x4b101060f4767186, num8, num7, num5, _position[0, 0x11], xf398ffaf32ffe055.All);
  537.             }
  538.             this.xe75f29bc258e83bf(x4b101060f4767186, num5, num6, _position[0, 0x10], (num7 - num6) - 1);
  539.             if (this.menuCommands.ExtraText.Length > 0)
  540.             {
  541.                 this.xe145f7beb24da7f5(x4b101060f4767186, rect);
  542.             }
  543.         }
  544.         protected x555516122dcc901e.POINT x4b688849d80162f6(x40255b11ef821fa3.MSG x8a41fbc87a3fb305)
  545.         {
  546.             x555516122dcc901e.POINT point;
  547.             point.x = (short) (((int) x8a41fbc87a3fb305.lParam) & 0xffff);
  548.             point.y = (short) ((((int) x8a41fbc87a3fb305.lParam) & -65536) >> 0x10);
  549.             if ((((x8a41fbc87a3fb305.message != 0xa2) && (x8a41fbc87a3fb305.message != 0xa8)) && ((x8a41fbc87a3fb305.message != 0xa5) && (x8a41fbc87a3fb305.message != 0xac))) && (((x8a41fbc87a3fb305.message != 0xa1) && (x8a41fbc87a3fb305.message != 0xa7)) && ((x8a41fbc87a3fb305.message != 0xa4) && (x8a41fbc87a3fb305.message != 0xab))))
  550.             {
  551.                 x61467fe65a98f20c.ClientToScreen(x8a41fbc87a3fb305.hwnd, ref point);
  552.             }
  553.             return point;
  554.         }
  555.         protected Size x4e2849ed170f5bc2()
  556.         {
  557.             this.drawCommands = new ArrayList();
  558.             int height = (_position[0, 4] + imageHeight) + _position[0, 6];
  559.             int width = ((((((_position[0, 5] + imageWidth) + _position[0, 7]) + _position[0, 8]) + _position[0, 9]) + _position[0, 10]) + _position[0, 11]) + _position[0, 12];
  560.             int num3 = this.textFont.Height;
  561.             if (num3 < height)
  562.             {
  563.                 num3 = height;
  564.             }
  565.             int num4 = SystemInformation.WorkingArea.Height;
  566.             int x = _position[0, 1];
  567.             int y = _position[0, 0];
  568.             int num7 = y;
  569.             int num8 = width;
  570.             int extraSize = 0;
  571.             int num10 = 0;
  572.             int row = 0;
  573.             int col = 0;
  574.             bool flag = false;
  575.             bool infrequent = false;
  576.             IntPtr dC = x61467fe65a98f20c.GetDC(IntPtr.Zero);
  577.             ArrayList list = new ArrayList();
  578.             using (Graphics graphics = Graphics.FromHdc(dC))
  579.             {
  580.                 if (this.menuCommands.ExtraText.Length > 0)
  581.                 {
  582.                     int num13 = ((int) graphics.MeasureString(this.menuCommands.ExtraText, this.menuCommands.ExtraFont).Height) + 1;
  583.                     this.extraSize = (num13 + _position[0, 20]) + (_position[0, 0x12] * 2);
  584.                     x += this.extraSize;
  585.                     extraSize = this.extraSize;
  586.                 }
  587.                 foreach (x5f4b657f68f87baa xfbffbaa in this.menuCommands)
  588.                 {
  589.                     xfbffbaa.OnUpdate(EventArgs.Empty);
  590.                     if (xfbffbaa.Visible && ((xfbffbaa.MenuCommands.Count <= 0) || xfbffbaa.MenuCommands.VisibleItems()))
  591.                     {
  592.                         if (xfbffbaa.Infrequent && !this.showInfrequent)
  593.                         {
  594.                             flag = true;
  595.                             continue;
  596.                         }
  597.                         int num14 = 0;
  598.                         int num15 = 0;
  599.                         if (xfbffbaa.Break)
  600.                         {
  601.                             row = 0;
  602.                             col++;
  603.                             this.xfbe050c2d5b2be39(list, num8);
  604.                             x += num8;
  605.                             int num16 = _position[0, 14];
  606.                             x2cc390e9409b0f3f xccebff = new x2cc390e9409b0f3f(new Rectangle(x, 0, num16, 0), false);
  607.                             this.drawCommands.Add(xccebff);
  608.                             x += num16;
  609.                             num7 = y;
  610.                             extraSize += num8 + num16;
  611.                             num8 = width;
  612.                         }
  613.                         if (xfbffbaa.Text == "-")
  614.                         {
  615.                             num14 = width;
  616.                             num15 = _position[0, 13];
  617.                         }
  618.                         else
  619.                         {
  620.                             num15 = num3;
  621.                             SizeF ef2 = graphics.MeasureString(xfbffbaa.Text, this.textFont);
  622.                             num14 = (width + ((int) ef2.Width)) + 1;
  623.                             if (xfbffbaa.Shortcut != Shortcut.None)
  624.                             {
  625.                                 ef2 = graphics.MeasureString(this.x8cf43133d25d686a(xfbffbaa.Shortcut), this.textFont);
  626.                                 num14 += (_position[0, 15] + ((int) ef2.Width)) + 1;
  627.                             }
  628.                         }
  629.                         if ((num7 + num15) >= num4)
  630.                         {
  631.                             row = 0;
  632.                             col++;
  633.                             this.xfbe050c2d5b2be39(list, num8);
  634.                             x += num8;
  635.                             int num17 = _position[0, 14];
  636.                             x2cc390e9409b0f3f xccebff2 = new x2cc390e9409b0f3f(new Rectangle(x, y, num17, 0), false);
  637.                             this.drawCommands.Add(xccebff2);
  638.                             x += num17;
  639.                             num7 = y;
  640.                             extraSize += num8 + num17;
  641.                             num8 = width;
  642.                             xccebff2.Infrequent = infrequent;
  643.                         }
  644.                         Rectangle drawRect = new Rectangle(x, num7, num14, num15);
  645.                         x2cc390e9409b0f3f xccebff3 = new x2cc390e9409b0f3f(xfbffbaa, drawRect, row, col);
  646.                         if (infrequent != xfbffbaa.Infrequent)
  647.                         {
  648.                             if (xfbffbaa.Infrequent)
  649.                             {
  650.                                 xccebff3.TopBorder = true;
  651.                             }
  652.                             else if (this.drawCommands.Count > 0)
  653.                             {
  654.                                 for (int i = this.drawCommands.Count - 1; i >= 0; i--)
  655.                                 {
  656.                                     if (!(this.drawCommands[i] as x2cc390e9409b0f3f).Separator)
  657.                                     {
  658.                                         (this.drawCommands[i] as x2cc390e9409b0f3f).BottomBorder = true;
  659.                                         break;
  660.                                     }
  661.                                 }
  662.                             }
  663.                         }
  664.                         if (!xccebff3.Separator)
  665.                         {
  666.                             infrequent = xfbffbaa.Infrequent;
  667.                         }
  668.                         this.drawCommands.Add(xccebff3);
  669.                         list.Add(xccebff3);
  670.                         if (num14 > num8)
  671.                         {
  672.                             num8 = num14;
  673.                         }
  674.                         num7 += num15;
  675.                         if (num7 > num10)
  676.                         {
  677.                             num10 = num7;
  678.                         }
  679.                         row++;
  680.                     }
  681.                 }
  682.                 if (flag)
  683.                 {
  684.                     Rectangle rectangle2 = new Rectangle(x, num7, width, height);
  685.                     x2cc390e9409b0f3f xccebff4 = new x2cc390e9409b0f3f(rectangle2, true);
  686.                     this.drawCommands.Add(xccebff4);
  687.                     list.Add(xccebff4);
  688.                     num7 += height;
  689.                     if (num7 > num10)
  690.                     {
  691.                         num10 = num7;
  692.                     }
  693.                 }
  694.                 this.xfbe050c2d5b2be39(list, num8);
  695.             }
  696.             x61467fe65a98f20c.ReleaseDC(IntPtr.Zero, dC);
  697.             int num19 = ((_position[0, 1] + extraSize) + num8) + _position[0, 3];
  698.             int num20 = (_position[0, 0] + num10) + _position[0, 2];
  699.             this.x5796c1a518d308ac(num10);
  700.             int num21 = _position[0, 0x11];
  701.             int num22 = _position[0, 0x10];
  702.             return new Size(num19 + num21, num20 + num22);
  703.         }
  704.         protected bool x5437d760e9a6340b()
  705.         {
  706.             int trackItem = this.trackItem;
  707.             int num2 = trackItem;
  708.             for (int i = 0; i < this.drawCommands.Count; i++)
  709.             {
  710.                 trackItem--;
  711.                 if (trackItem == num2)
  712.                 {
  713.                     return false;
  714.                 }
  715.                 if (trackItem < 0)
  716.                 {
  717.                     trackItem = this.drawCommands.Count - 1;
  718.                 }
  719.                 x2cc390e9409b0f3f xccebff = this.drawCommands[trackItem] as x2cc390e9409b0f3f;
  720.                 if ((!xccebff.Separator && xccebff.Enabled) && (trackItem != this.trackItem))
  721.                 {
  722.                     this.xeb515a5b77846afe(this.trackItem, trackItem, false, false);
  723.                     return true;
  724.                 }
  725.             }
  726.             return false;
  727.         }
  728.         protected void x5796c1a518d308ac(int x3b2a52f70523c25a)
  729.         {
  730.             foreach (x2cc390e9409b0f3f xccebff in this.drawCommands)
  731.             {
  732.                 if (xccebff.VerticalSeparator)
  733.                 {
  734.                     Rectangle drawRect = xccebff.DrawRect;
  735.                     xccebff.DrawRect = new Rectangle(drawRect.Left, drawRect.Top, drawRect.Width, x3b2a52f70523c25a);
  736.                 }
  737.             }
  738.         }
  739.         protected bool x5b2e42a68d835b31()
  740.         {
  741.             int trackItem = this.trackItem;
  742.             for (int i = 0; i < this.drawCommands.Count; i++)
  743.             {
  744.                 trackItem++;
  745.                 if (trackItem >= this.drawCommands.Count)
  746.                 {
  747.                     trackItem = 0;
  748.                 }
  749.                 x2cc390e9409b0f3f xccebff = this.drawCommands[trackItem] as x2cc390e9409b0f3f;
  750.                 if ((!xccebff.Separator && xccebff.Enabled) && (trackItem != this.trackItem))
  751.                 {
  752.                     this.xeb515a5b77846afe(this.trackItem, trackItem, false, false);
  753.                     return true;
  754.                 }
  755.             }
  756.             return false;
  757.         }
  758.         internal x5f4b657f68f87baa x6192996f26aa9421(Point x0ce73f6cbd7d5515, Point xd682fa060330cf55, xdbfa333b4cd503e0 x23e85093ba3a7d1d, xd53b20b7b4b2a08a x2ac8fd3ce3986cdc, int xb2c6baf52a3ff3eb, bool xacc37ebdd71fcc44, x3c41176af7e54b01 x37f2fc2a7f30f790, bool x0a7391c99fcdc469, ref int x0cd2bb383a46f073)
  759.         {
  760.             this.direction = x23e85093ba3a7d1d;
  761.             this.parentControl = x37f2fc2a7f30f790;
  762.             this.borderGap = xb2c6baf52a3ff3eb;
  763.             this.animateIn = x0a7391c99fcdc469;
  764.             xd53b20b7b4b2a08a menuCommands = this.menuCommands;
  765.             this.menuCommands = x2ac8fd3ce3986cdc;
  766.             this.screenPosition = x0ce73f6cbd7d5515;
  767.             this.aboveScreenPosition = xd682fa060330cf55;
  768.             this.leftScreenPosition = x0ce73f6cbd7d5515;
  769.             x5f4b657f68f87baa xfbffbaa = this.x6e4244e25732db7d(xacc37ebdd71fcc44);
  770.             this.menuCommands = menuCommands;
  771.             this.parentControl = null;
  772.             this.returnDir = x0cd2bb383a46f073;
  773.             return xfbffbaa;
  774.         }
  775.         protected int x65c1cc54cc8b0e75(char xba08ce632055a1d9)
  776.         {
  777.             for (int i = 0; i < this.drawCommands.Count; i++)
  778.             {
  779.                 x2cc390e9409b0f3f xccebff = this.drawCommands[i] as x2cc390e9409b0f3f;
  780.                 if (xccebff.Enabled && (xba08ce632055a1d9 == xccebff.Mnemonic))
  781.                 {
  782.                     if (!xccebff.SubMenu)
  783.                     {
  784.                         return i;
  785.                     }
  786.                     if (this.trackItem != i)
  787.                     {
  788.                         this.xeb515a5b77846afe(this.trackItem, i, true, false);
  789.                     }
  790.                     return -1;
  791.                 }
  792.             }
  793.             return -1;
  794.         }
  795.         protected Point x6e375ee3ca34b13b(Size x001544edc57babc2)
  796.         {
  797.             Rectangle workingArea = Screen.GetWorkingArea(this.screenPosition);
  798.             Point screenPosition = this.screenPosition;
  799.             int width = workingArea.Width;
  800.             int left = workingArea.Left;
  801.             int right = workingArea.Right;
  802.             int height = workingArea.Height;
  803.             int bottom = workingArea.Bottom;
  804.             int top = workingArea.Top;
  805.             this.excludeTop = true;
  806.             this.excludeOffset = 0;
  807.             x001544edc57babc2.Width -= _position[0, 0x10];
  808.             if (this.popupDown)
  809.             {
  810.                 if ((screenPosition.Y + x001544edc57babc2.Height) > bottom)
  811.                 {
  812.                     if (((this.parentControl != null) && (this.parentMenu == null)) && ((this.aboveScreenPosition.Y - x001544edc57babc2.Height) > top))
  813.                     {
  814.                         screenPosition.Y = this.aboveScreenPosition.Y - x001544edc57babc2.Height;
  815.                         this.popupDown = false;
  816.                         this.excludeTop = false;
  817.                         this.parentControl.xd502a472a14a9c04();
  818.                     }
  819.                     if ((screenPosition.Y + x001544edc57babc2.Height) > bottom)
  820.                     {
  821.                         if (this.parentMenu != null)
  822.                         {
  823.                             this.popupDown = false;
  824.                             if ((this.aboveScreenPosition.Y - x001544edc57babc2.Height) > top)
  825.                             {
  826.                                 screenPosition.Y = this.aboveScreenPosition.Y - x001544edc57babc2.Height;
  827.                             }
  828.                             else
  829.                             {
  830.                                 screenPosition.Y = top;
  831.                             }
  832.                         }
  833.                         else
  834.                         {
  835.                             screenPosition.Y = (bottom - x001544edc57babc2.Height) - 1;
  836.                         }
  837.                     }
  838.                 }
  839.             }
  840.             else if ((screenPosition.Y - x001544edc57babc2.Height) < top)
  841.             {
  842.                 this.popupDown = true;
  843.                 if ((screenPosition.Y + x001544edc57babc2.Height) > bottom)
  844.                 {
  845.                     screenPosition.Y = (bottom - x001544edc57babc2.Height) - 1;
  846.                 }
  847.             }
  848.             else
  849.             {
  850.                 screenPosition.Y -= x001544edc57babc2.Height;
  851.             }
  852.             if (this.popupRight)
  853.             {
  854.                 if ((screenPosition.X + x001544edc57babc2.Width) > right)
  855.                 {
  856.                     if (this.parentMenu != null)
  857.                     {
  858.                         this.popupRight = false;
  859.                         screenPosition.X = this.leftScreenPosition.X - x001544edc57babc2.Width;
  860.                         if (screenPosition.X < left)
  861.                         {
  862.                             screenPosition.X = left;
  863.                         }
  864.                         return screenPosition;
  865.                     }
  866.                     int num5 = (right - x001544edc57babc2.Width) - 1;
  867.                     this.excludeOffset = screenPosition.X - num5;
  868.                     screenPosition.X = num5;
  869.                 }
  870.                 return screenPosition;
  871.             }
  872.             screenPosition.X = this.leftScreenPosition.X;
  873.             if ((screenPosition.X - x001544edc57babc2.Width) < left)
  874.             {
  875.                 this.popupRight = true;
  876.                 if ((this.screenPosition.X + x001544edc57babc2.Width) > right)
  877.                 {
  878.                     screenPosition.X = (right - x001544edc57babc2.Width) - 1;
  879.                     return screenPosition;
  880.                 }
  881.                 screenPosition.X = this.screenPosition.X;
  882.                 return screenPosition;
  883.             }
  884.             screenPosition.X -= x001544edc57babc2.Width;
  885.             return screenPosition;
  886.         }
  887.         protected x5f4b657f68f87baa x6e4244e25732db7d(bool xacc37ebdd71fcc44)
  888.         {
  889.             try
  890.             {
  891.                 this.returnCommand = null;
  892.                 this.trackItem = -1;
  893.                 this.exitLoop = false;
  894.                 this.mouseOver = false;
  895.                 this.returnDir = 0;
  896.                 bool flag = false;
  897.                 this.animateFirst = true;
  898.                 this.xb3525a0e7d2fd376();
  899.                 x40255b11ef821fa3.MSG msg = new x40255b11ef821fa3.MSG();
  900.                 if (xacc37ebdd71fcc44)
  901.                 {
  902.                     this.x5b2e42a68d835b31();
  903.                 }
  904.                 x61467fe65a98f20c.SetCursor(x61467fe65a98f20c.LoadCursor(IntPtr.Zero, 0x7f00));
  905.                 bool flag2 = x61467fe65a98f20c.HideCaret(IntPtr.Zero);
  906.                 while (!this.exitLoop)
  907.                 {
  908.                     if (!x61467fe65a98f20c.WaitMessage())
  909.                     {
  910.                         continue;
  911.                     }
  912.                     while (!this.exitLoop && x61467fe65a98f20c.PeekMessage(ref msg, 0, 0, 0, 0))
  913.                     {
  914.                         int num3;
  915.                         bool flag3 = false;
  916.                         int num = this.currentSize.Width - _position[0, 0x10];
  917.                         int num2 = this.currentSize.Height - _position[0, 0x11];
  918.                         if ((((msg.message == 0x202) || (msg.message == 520)) || ((msg.message == 0x205) || (msg.message == 0x20c))) || (((msg.message == 0xa2) || (msg.message == 0xa8)) || ((msg.message == 0xa5) || (msg.message == 0xac))))
  919.                         {
  920.                             x555516122dcc901e.POINT point = this.x4b688849d80162f6(msg);
  921.                             if (((point.x >= this.currentPoint.X) && (point.x <= (this.currentPoint.X + num))) && ((point.y >= this.currentPoint.Y) && (point.y <= (this.currentPoint.Y + num2))))
  922.                             {
  923.                                 this.xd6cfa3f3f3125e82(point.x, point.y);
  924.                                 flag3 = true;
  925.                             }
  926.                             else
  927.                             {
  928.                                 x902c4aee45bfd906 xcaeebfd = this.x3c6f7570c20e3f7d(point, ref msg);
  929.                                 if (xcaeebfd != null)
  930.                                 {
  931.                                     xcaeebfd.xd6cfa3f3f3125e82(point.x, point.y);
  932.                                     flag3 = true;
  933.                                 }
  934.                             }
  935.                         }
  936.                         if ((((msg.message == 0x201) || (msg.message == 0x207)) || ((msg.message == 0x204) || (msg.message == 0x20b))) || (((msg.message == 0xa1) || (msg.message == 0xa7)) || ((msg.message == 0xa4) || (msg.message == 0xab))))
  937.                         {
  938.                             x555516122dcc901e.POINT point2 = this.x4b688849d80162f6(msg);
  939.                             if (((point2.x >= this.currentPoint.X) && (point2.x <= (this.currentPoint.X + num))) && ((point2.y >= this.currentPoint.Y) && (point2.y <= (this.currentPoint.Y + num2))))
  940.                             {
  941.                                 flag3 = true;
  942.                             }
  943.                             else if (this.x3c6f7570c20e3f7d(point2, ref msg) == null)
  944.                             {
  945.                                 if (this.x277ff37e12aff68b(point2, ref msg))
  946.                                 {
  947.                                     this.parentControl.x2ea07c3ab5d970d4(point2);
  948.                                     flag3 = true;
  949.                                 }
  950.                                 else
  951.                                 {
  952.                                     this.exitLoop = true;
  953.                                     flag = true;
  954.                                     if ((this.parentControl != null) && (msg.hwnd == this.parentControl.Handle))
  955.                                     {
  956.                                         flag = false;
  957.                                     }
  958.                                 }
  959.                             }
  960.                             else
  961.                             {
  962.                                 flag3 = true;
  963.                             }
  964.                         }
  965.                         if (msg.message == 0x200)
  966.                         {
  967.                             x555516122dcc901e.POINT point3 = this.x4b688849d80162f6(msg);
  968.                             if (((point3.x >= this.currentPoint.X) && (point3.x <= (this.currentPoint.X + num))) && ((point3.y >= this.currentPoint.Y) && (point3.y <= (this.currentPoint.Y + num2))))
  969.                             {
  970.                                 this.x136735fdfe6d04ea(point3.x, point3.y);
  971.                             }
  972.                             else
  973.                             {
  974.                                 if (this.mouseOver)
  975.                                 {
  976.                                     this.xa84c74b103039157();
  977.                                 }
  978.                                 x902c4aee45bfd906 xcaeebfd2 = this.x3c6f7570c20e3f7d(point3, ref msg);
  979.                                 if (xcaeebfd2 != null)
  980.                                 {
  981.                                     xcaeebfd2.x136735fdfe6d04ea(point3.x, point3.y);
  982.                                 }
  983.                                 else if (this.x277ff37e12aff68b(point3, ref msg))
  984.                                 {
  985.                                     this.parentControl.x136735fdfe6d04ea(point3);
  986.                                 }
  987.                             }
  988.                             flag3 = true;
  989.                         }
  990.                         if (msg.message == 0x20)
  991.                         {
  992.                             this.x773209141f430902();
  993.                             flag3 = true;
  994.                         }
  995.                         if (msg.message == 260)
  996.                         {
  997.                             if (((int) msg.wParam) == 0x12)
  998.                             {
  999.                                 this.exitLoop = true;
  1000.                             }
  1001.                             else
  1002.                             {
  1003.                                 msg.message = 0x100;
  1004.                             }
  1005.                         }
  1006.                         if (msg.message == 0x100)
  1007.                         {
  1008.                             int wParam = (int) msg.wParam;
  1009.                             if (wParam != 13)
  1010.                             {
  1011.                                 switch (wParam)
  1012.                                 {
  1013.                                     case 0x25:
  1014.                                         this.x0e37e200024f43ba();
  1015.                                         goto Label_0543;
  1016.                                     case 0x26:
  1017.                                         this.x5437d760e9a6340b();
  1018.                                         goto Label_0543;
  1019.                                     case 0x27:
  1020.                                         if (this.xb2aa7fc859b3d5b7())
  1021.                                         {
  1022.                                             flag = true;
  1023.                                         }
  1024.                                         goto Label_0543;
  1025.                                     case 40:
  1026.                                         this.x5b2e42a68d835b31();
  1027.                                         goto Label_0543;
  1028.                                     case 0x1b:
  1029.                                         goto Label_04F6;
  1030.                                 }
  1031.                                 goto Label_04FF;
  1032.                             }
  1033.                             if (this.trackItem != -1)
  1034.                             {
  1035.                                 x2cc390e9409b0f3f xccebff = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  1036.                                 if (xccebff.SubMenu)
  1037.                                 {
  1038.                                     this.x0760506d6abf77a2(this.trackItem, false);
  1039.                                     flag = true;
  1040.                                 }
  1041.                                 else if (xccebff.Expansion)
  1042.                                 {
  1043.                                     this.x057464a452da34b7();
  1044.                                 }
  1045.                                 else
  1046.                                 {
  1047.                                     this.returnCommand = xccebff.MenuCommand;
  1048.                                     this.exitLoop = true;
  1049.                                 }
  1050.                             }
  1051.                         }
  1052.                         goto Label_0543;
  1053.                     Label_04F6:
  1054.                         this.exitLoop = true;
  1055.                         goto Label_0543;
  1056.                     Label_04FF:
  1057.                         num3 = this.x65c1cc54cc8b0e75((char) ((int) msg.wParam));
  1058.                         if (num3 != -1)
  1059.                         {
  1060.                             x2cc390e9409b0f3f xccebff2 = this.drawCommands[num3] as x2cc390e9409b0f3f;
  1061.                             this.returnCommand = xccebff2.MenuCommand;
  1062.                             this.exitLoop = true;
  1063.                             flag = true;
  1064.                         }
  1065.                     Label_0543:
  1066.                         if (((msg.message == 0x100) || (msg.message == 0x101)) || ((msg.message == 260) || (msg.message == 0x105)))
  1067.                         {
  1068.                             flag3 = true;
  1069.                         }
  1070.                         if (flag3)
  1071.                         {
  1072.                             x40255b11ef821fa3.MSG lpMsg = new x40255b11ef821fa3.MSG();
  1073.                             x61467fe65a98f20c.GetMessage(ref lpMsg, IntPtr.Zero, 0, 0);
  1074.                         }
  1075.                         else
  1076.                         {
  1077.                             if (!flag)
  1078.                             {
  1079.                                 if (x61467fe65a98f20c.GetMessage(ref msg, IntPtr.Zero, 0, 0))
  1080.                                 {
  1081.                                     x61467fe65a98f20c.TranslateMessage(ref msg);
  1082.                                     x61467fe65a98f20c.DispatchMessage(ref msg);
  1083.                                 }
  1084.                                 continue;
  1085.                             }
  1086.                             flag = false;
  1087.                         }
  1088.                     }
  1089.                 }
  1090.                 if (flag2)
  1091.                 {
  1092.                     x61467fe65a98f20c.ShowCaret(IntPtr.Zero);
  1093.                 }
  1094.                 this.xeb515a5b77846afe(this.trackItem, -1, false, false);
  1095.                 this.x4139e66e6dfaac52();
  1096.                 this.DestroyHandle();
  1097.                 if (((this.parentMenu == null) && (this.returnCommand != null)) && (this.parentControl == null))
  1098.                 {
  1099.                     this.returnCommand.OnClick(EventArgs.Empty);
  1100.                 }
  1101.                 return this.returnCommand;
  1102.             }
  1103.             catch (Exception)
  1104.             {
  1105.                 return null;
  1106.             }
  1107.         }
  1108.         protected x5f4b657f68f87baa x6e4244e25732db7d(Point x9348d50e682f780a, Point xf361a72b1913ee9f, xd53b20b7b4b2a08a x2ac8fd3ce3986cdc, x902c4aee45bfd906 xb13f2de377f27597, bool xacc37ebdd71fcc44, x3c41176af7e54b01 x37f2fc2a7f30f790, bool xc8609d9b3214b3e7, bool x8e0eb9fe60b28fae, bool x0a7391c99fcdc469, ref int x0cd2bb383a46f073)
  1109.         {
  1110.             this.direction = xdbfa333b4cd503e0.Horizontal;
  1111.             this.parentControl = x37f2fc2a7f30f790;
  1112.             this.parentMenu = xb13f2de377f27597;
  1113.             this.animateIn = x0a7391c99fcdc469;
  1114.             xd53b20b7b4b2a08a menuCommands = this.menuCommands;
  1115.             this.menuCommands = x2ac8fd3ce3986cdc;
  1116.             this.screenPosition = x9348d50e682f780a;
  1117.             this.aboveScreenPosition = x9348d50e682f780a;
  1118.             this.leftScreenPosition = xf361a72b1913ee9f;
  1119.             this.popupRight = xc8609d9b3214b3e7;
  1120.             this.popupDown = x8e0eb9fe60b28fae;
  1121.             x5f4b657f68f87baa xfbffbaa = this.x6e4244e25732db7d(xacc37ebdd71fcc44);
  1122.             this.menuCommands = menuCommands;
  1123.             this.parentControl = null;
  1124.             this.parentMenu = null;
  1125.             this.returnDir = x0cd2bb383a46f073;
  1126.             return xfbffbaa;
  1127.         }
  1128.         protected void x76a103c0a87eb01c()
  1129.         {
  1130.             this.timer.Stop();
  1131.             if (this.popupItem != this.trackItem)
  1132.             {
  1133.                 this.xeb515a5b77846afe(this.trackItem, this.popupItem, false, true);
  1134.             }
  1135.             if (this.parentMenu != null)
  1136.             {
  1137.                 this.parentMenu.x76a103c0a87eb01c();
  1138.             }
  1139.         }
  1140.         protected void x773209141f430902()
  1141.         {
  1142.             x61467fe65a98f20c.SetCursor(x61467fe65a98f20c.LoadCursor(IntPtr.Zero, 0x7f00));
  1143.         }
  1144.         protected static unsafe Bitmap x7ca9c34ba153ef81(int x9b0739496f8b5475, int x4d5aabc7a55b12ba)
  1145.         {
  1146.             if (((shadowCacheWidth != x9b0739496f8b5475) || (shadowCacheHeight != x4d5aabc7a55b12ba)) || (shadowCache == null))
  1147.             {
  1148.                 if (shadowCache != null)
  1149.                 {
  1150.                     shadowCache.Dispose();
  1151.                 }
  1152.                 Bitmap bitmap = new Bitmap(x9b0739496f8b5475, x4d5aabc7a55b12ba, PixelFormat.Format32bppArgb);
  1153.                 BitmapData bitmapdata = bitmap.LockBits(new Rectangle(0, 0, x9b0739496f8b5475, x4d5aabc7a55b12ba), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
  1154.                 uint* numPtr = (uint*) bitmapdata.Scan0;
  1155.                 for (int i = 0; i < x4d5aabc7a55b12ba; i++)
  1156.                 {
  1157.                     int num2 = (bitmapdata.Stride * i) / 4;
  1158.                     int num3 = (0x40 * (x4d5aabc7a55b12ba - i)) / (x4d5aabc7a55b12ba + 1);
  1159.                     for (int j = 0; j < x9b0739496f8b5475; j++)
  1160.                     {
  1161.                         int num5 = (num3 * (x9b0739496f8b5475 - j)) / (x9b0739496f8b5475 + 1);
  1162.                         numPtr[num2 + j] = (uint) (num5 << 0x18);
  1163.                     }
  1164.                 }
  1165.                 bitmap.UnlockBits(bitmapdata);
  1166.                 shadowCache = bitmap;
  1167.                 shadowCacheWidth = x9b0739496f8b5475;
  1168.                 shadowCacheHeight = x4d5aabc7a55b12ba;
  1169.             }
  1170.             return shadowCache;
  1171.         }
  1172.         protected Color x898c3842f8dd56e5(Color xfe9df16f7e7c346d, Color x753506715ee62862, int x6ad505c7ef981b0e)
  1173.         {
  1174.             Color color = Color.FromArgb(0xff, xfe9df16f7e7c346d);
  1175.             Color color2 = Color.FromArgb(0xff, x753506715ee62862);
  1176.             float r = color.R;
  1177.             float g = color.G;
  1178.             float b = color.B;
  1179.             float num4 = color2.R;
  1180.             float num5 = color2.G;
  1181.             float num6 = color2.B;
  1182.             float num7 = ((r * x6ad505c7ef981b0e) / 255f) + (num4 * (((float) (0xff - x6ad505c7ef981b0e)) / 255f));
  1183.             float num8 = ((g * x6ad505c7ef981b0e) / 255f) + (num5 * (((float) (0xff - x6ad505c7ef981b0e)) / 255f));
  1184.             float num9 = ((b * x6ad505c7ef981b0e) / 255f) + (num6 * (((float) (0xff - x6ad505c7ef981b0e)) / 255f));
  1185.             byte red = (byte) num7;
  1186.             byte green = (byte) num8;
  1187.             byte blue = (byte) num9;
  1188.             return Color.FromArgb(0xff, red, green, blue);
  1189.         }
  1190.         protected string x8cf43133d25d686a(Shortcut xc0de55fd2ca182a4)
  1191.         {
  1192.             char ch = (char) ((ushort) (xc0de55fd2ca182a4 & ((Shortcut) 0xffff)));
  1193.             if ((ch < '0') || (ch > '9'))
  1194.             {
  1195.                 return TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString((Keys) xc0de55fd2ca182a4);
  1196.             }
  1197.             string str = "";
  1198.             int num = (int) (((long) xc0de55fd2ca182a4) & 0xffff0000L);
  1199.             if ((num & 0x10000) != 0)
  1200.             {
  1201.                 str = str + "Shift+";
  1202.             }
  1203.             if ((num & 0x20000) != 0)
  1204.             {
  1205.                 str = str + "Ctrl+";
  1206.             }
  1207.             if ((num & 0x40000) != 0)
  1208.             {
  1209.                 str = str + "Alt+";
  1210.             }
  1211.             return (str + ch);
  1212.         }
  1213.         protected void x9119fce83e4631ad()
  1214.         {
  1215.             this.x9119fce83e4631ad(this.currentPoint, this.currentSize, 0xff);
  1216.         }
  1217.         protected void x9119fce83e4631ad(byte x6ad505c7ef981b0e)
  1218.         {
  1219.             this.x9119fce83e4631ad(this.currentPoint, this.currentSize, x6ad505c7ef981b0e);
  1220.         }
  1221.         protected void x9119fce83e4631ad(Point x2f7096dac971d6ec, Size x0ceec69a97f73617, byte x6ad505c7ef981b0e)
  1222.         {
  1223.             Bitmap image = new Bitmap(x0ceec69a97f73617.Width, x0ceec69a97f73617.Height, PixelFormat.Format32bppArgb);
  1224.             using (Graphics graphics = Graphics.FromImage(image))
  1225.             {
  1226.                 x555516122dcc901e.SIZE size;
  1227.                 x555516122dcc901e.POINT point;
  1228.                 x555516122dcc901e.POINT point2;
  1229.                 Rectangle rectangle = new Rectangle(0, 0, x0ceec69a97f73617.Width, x0ceec69a97f73617.Height);
  1230.                 this.x4af0f9e5d7ac184a(graphics, rectangle);
  1231.                 this.x05a10b378cdf8119(graphics);
  1232.                 IntPtr dC = x61467fe65a98f20c.GetDC(IntPtr.Zero);
  1233.                 IntPtr hDC = x31775329b2a4ff52.CreateCompatibleDC(dC);
  1234.                 IntPtr hbitmap = image.GetHbitmap(Color.FromArgb(0));
  1235.                 IntPtr hObject = x31775329b2a4ff52.SelectObject(hDC, hbitmap);
  1236.                 size.cx = x0ceec69a97f73617.Width;
  1237.                 size.cy = x0ceec69a97f73617.Height;
  1238.                 point.x = x2f7096dac971d6ec.X;
  1239.                 point.y = x2f7096dac971d6ec.Y;
  1240.                 point2.x = 0;
  1241.                 point2.y = 0;
  1242.                 x1439a41cfa24189f.BLENDFUNCTION pblend = new x1439a41cfa24189f.BLENDFUNCTION();
  1243.                 pblend.BlendOp = 0;
  1244.                 pblend.BlendFlags = 0;
  1245.                 pblend.SourceConstantAlpha = x6ad505c7ef981b0e;
  1246.                 pblend.AlphaFormat = 1;
  1247.                 x61467fe65a98f20c.UpdateLayeredWindow(base.Handle, dC, ref point, ref size, hDC, ref point2, 0, ref pblend, 2);
  1248.                 x31775329b2a4ff52.SelectObject(hDC, hObject);
  1249.                 x61467fe65a98f20c.ReleaseDC(IntPtr.Zero, dC);
  1250.                 x31775329b2a4ff52.DeleteObject(hbitmap);
  1251.                 x31775329b2a4ff52.DeleteDC(hDC);
  1252.             }
  1253.         }
  1254.         protected void x95f5f55ee201fb8f()
  1255.         {
  1256.             xae4dd1cafd2eb77c.RECT lpRect = new xae4dd1cafd2eb77c.RECT();
  1257.             x61467fe65a98f20c.GetWindowRect(base.Handle, ref lpRect);
  1258.             Rectangle rectangle = new Rectangle(0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top);
  1259.             using (Graphics graphics = Graphics.FromHwnd(base.Handle))
  1260.             {
  1261.                 this.x4af0f9e5d7ac184a(graphics, rectangle);
  1262.                 this.x05a10b378cdf8119(graphics);
  1263.             }
  1264.         }
  1265.         protected void xa1715c5212ff8a33()
  1266.         {
  1267.             this.layered = supportsLayered;
  1268.             Size size = this.x4e2849ed170f5bc2();
  1269.             Point point = this.x1339f634e34e0e03(size);
  1270.             if (this.menuCommands.Count == 0)
  1271.             {
  1272.                 size = new Size(0, 0);
  1273.             }
  1274.             CreateParams cp = new CreateParams();
  1275.             cp.Caption = "NativeSkinContextMenu";
  1276.             cp.X = point.X;
  1277.             cp.Y = point.Y;
  1278.             cp.Height = size.Height;
  1279.             cp.Width = size.Width;
  1280.             cp.Parent = IntPtr.Zero;
  1281.             cp.Style = -2147483648;
  1282.             cp.ExStyle = 0x88;
  1283.             if (this.layered)
  1284.             {
  1285.                 cp.ExStyle += 0x80000;
  1286.             }
  1287.             this.CreateHandle(cp);
  1288.             if (!this.layered)
  1289.             {
  1290.                 this.x1803d70928e3ae9b(size);
  1291.             }
  1292.             this.currentSize = size;
  1293.             this.currentPoint = point;
  1294.             bool flag = false;
  1295.             if (this.layered)
  1296.             {
  1297.                 this.x9119fce83e4631ad();
  1298.                 bool flag2 = false;
  1299.                 switch (this.animateItem)
  1300.                 {
  1301.                     case x6fd23f8bad2f3ced.No:
  1302.                         flag2 = false;
  1303.                         break;
  1304.                     case x6fd23f8bad2f3ced.Yes:
  1305.                         flag2 = true;
  1306.                         break;
  1307.                     case x6fd23f8bad2f3ced.System:
  1308.                     {
  1309.                         int bRetValue = 0;
  1310.                         x61467fe65a98f20c.SystemParametersInfoA(0x1002, 0, ref bRetValue, 0);
  1311.                         flag2 = bRetValue != 0;
  1312.                         break;
  1313.                     }
  1314.                 }
  1315.                 if (flag2 && this.animateIn)
  1316.                 {
  1317.                     uint animateStyle = (uint) this.animateStyle;
  1318.                     if (this.animateStyle == x1f5697535eab37b9.System)
  1319.                     {
  1320.                         int num3 = 0;
  1321.                         x61467fe65a98f20c.SystemParametersInfoA(0x1012, 0, ref num3, 0);
  1322.                         if (num3 != 0)
  1323.                         {
  1324.                             animateStyle = 0x80000;
  1325.                         }
  1326.                         else
  1327.                         {
  1328.                             animateStyle = 0x40005;
  1329.                         }
  1330.                     }
  1331.                     if ((animateStyle & 0x80000) != 0)
  1332.                     {
  1333.                         this.xf1420593eaecc724(true);
  1334.                     }
  1335.                     else
  1336.                     {
  1337.                         x61467fe65a98f20c.AnimateWindow(base.Handle, (uint) this.animateTime, animateStyle);
  1338.                     }
  1339.                     flag = true;
  1340.                 }
  1341.             }
  1342.             if (!flag)
  1343.             {
  1344.                 x61467fe65a98f20c.ShowWindow(base.Handle, 4);
  1345.             }
  1346.         }
  1347.         protected void xa68b9c37c0ff7fc5(ref Message x6088325dec1baa2a)
  1348.         {
  1349.             this.timer.Stop();
  1350.             this.exitLoop = true;
  1351.         }
  1352.         protected void xa84c74b103039157()
  1353.         {
  1354.             if ((this.trackItem != -1) && (this.childMenu == null))
  1355.             {
  1356.                 this.xeb515a5b77846afe(this.trackItem, -1, false, false);
  1357.             }
  1358.             this.mouseOver = false;
  1359.             this.lastMousePosition = new Point(-1, -1);
  1360.         }
  1361.         protected bool xb2aa7fc859b3d5b7()
  1362.         {
  1363.             bool flag = this.parentControl != null;
  1364.             bool flag2 = false;
  1365.             bool flag3 = false;
  1366.             if (this.trackItem != -1)
  1367.             {
  1368.                 x2cc390e9409b0f3f xccebff = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  1369.                 if (xccebff.SubMenu)
  1370.                 {
  1371.                     this.x0760506d6abf77a2(this.trackItem, true);
  1372.                     flag3 = true;
  1373.                 }
  1374.                 else
  1375.                 {
  1376.                     int col = xccebff.Col;
  1377.                     int row = xccebff.Row;
  1378.                     int num3 = -1;
  1379.                     int num4 = -1;
  1380.                     int num5 = col + 1;
  1381.                     x2cc390e9409b0f3f xccebff2 = null;
  1382.                     for (int i = 0; i < this.drawCommands.Count; i++)
  1383.                     {
  1384.                         x2cc390e9409b0f3f xccebff3 = this.drawCommands[i] as x2cc390e9409b0f3f;
  1385.                         if ((((xccebff3.Col == num5) && (xccebff3.Row <= row)) && ((xccebff3.Row > num4) && !xccebff3.Separator)) && xccebff3.Enabled)
  1386.                         {
  1387.                             num4 = xccebff3.Row;
  1388.                             xccebff2 = xccebff3;
  1389.                             num3 = i;
  1390.                         }
  1391.                     }
  1392.                     if (xccebff2 != null)
  1393.                     {
  1394.                         this.xeb515a5b77846afe(this.trackItem, num3, false, false);
  1395.                     }
  1396.                     else
  1397.                     {
  1398.                         flag2 = true;
  1399.                     }
  1400.                 }
  1401.             }
  1402.             else if (this.parentMenu != null)
  1403.             {
  1404.                 if (!this.x5b2e42a68d835b31())
  1405.                 {
  1406.                     flag2 = true;
  1407.                 }
  1408.             }
  1409.             else
  1410.             {
  1411.                 flag2 = true;
  1412.             }
  1413.             if (flag && flag2)
  1414.             {
  1415.                 this.returnCommand = null;
  1416.                 this.timer.Stop();
  1417.                 this.exitLoop = true;
  1418.                 this.returnDir = 1;
  1419.             }
  1420.             return flag3;
  1421.         }
  1422.         protected void xb3525a0e7d2fd376()
  1423.         {
  1424.             this.layered = supportsLayered;
  1425.             Size size = this.x4e2849ed170f5bc2();
  1426.             Point point = this.x6e375ee3ca34b13b(size);
  1427.             if (this.menuCommands.Count == 0)
  1428.             {
  1429.                 size = new Size(0, 0);
  1430.             }
  1431.             CreateParams cp = new CreateParams();
  1432.             cp.Caption = "NativeSkinContextMenu";
  1433.             cp.X = point.X;
  1434.             cp.Y = point.Y;
  1435.             cp.Height = size.Height;
  1436.             cp.Width = size.Width;
  1437.             cp.Parent = IntPtr.Zero;
  1438.             cp.Style = -2147483648;
  1439.             cp.ExStyle = 0x88;
  1440.             if (this.layered)
  1441.             {
  1442.                 cp.ExStyle += 0x80000;
  1443.             }
  1444.             this.CreateHandle(cp);
  1445.             if (!this.layered)
  1446.             {
  1447.                 this.x1803d70928e3ae9b(size);
  1448.             }
  1449.             this.currentSize = size;
  1450.             this.currentPoint = point;
  1451.             bool flag = false;
  1452.             if (this.layered)
  1453.             {
  1454.                 this.x9119fce83e4631ad();
  1455.                 bool flag2 = false;
  1456.                 switch (this.animateItem)
  1457.                 {
  1458.                     case x6fd23f8bad2f3ced.No:
  1459.                         flag2 = false;
  1460.                         break;
  1461.                     case x6fd23f8bad2f3ced.Yes:
  1462.                         flag2 = true;
  1463.                         break;
  1464.                     case x6fd23f8bad2f3ced.System:
  1465.                     {
  1466.                         int bRetValue = 0;
  1467.                         x61467fe65a98f20c.SystemParametersInfoA(0x1002, 0, ref bRetValue, 0);
  1468.                         flag2 = bRetValue != 0;
  1469.                         break;
  1470.                     }
  1471.                 }
  1472.                 if (flag2 && this.animateIn)
  1473.                 {
  1474.                     uint animateStyle = (uint) this.animateStyle;
  1475.                     if (this.animateStyle == x1f5697535eab37b9.System)
  1476.                     {
  1477.                         int num3 = 0;
  1478.                         x61467fe65a98f20c.SystemParametersInfoA(0x1012, 0, ref num3, 0);
  1479.                         if (num3 != 0)
  1480.                         {
  1481.                             animateStyle = 0x80000;
  1482.                         }
  1483.                         else
  1484.                         {
  1485.                             animateStyle = 0x40005;
  1486.                         }
  1487.                     }
  1488.                     if ((animateStyle & 0x80000) != 0)
  1489.                     {
  1490.                         this.xf1420593eaecc724(true);
  1491.                     }
  1492.                     else
  1493.                     {
  1494.                         x61467fe65a98f20c.AnimateWindow(base.Handle, (uint) this.animateTime, animateStyle);
  1495.                     }
  1496.                     flag = true;
  1497.                 }
  1498.             }
  1499.             if (!flag)
  1500.             {
  1501.                 x61467fe65a98f20c.ShowWindow(base.Handle, 4);
  1502.             }
  1503.         }
  1504.         internal void xb5a5bdae3ba8936b(Graphics x4b101060f4767186, x2cc390e9409b0f3f xd2a8bb4342ab4ef6, bool x15a0329046fb799f)
  1505.         {
  1506.             Brush brush;
  1507.             int num10;
  1508.             Rectangle rectangle7;
  1509.             SolidBrush brush9;
  1510.             Rectangle drawRect = xd2a8bb4342ab4ef6.DrawRect;
  1511.             x5f4b657f68f87baa menuCommand = xd2a8bb4342ab4ef6.MenuCommand;
  1512.             Color color1 = this.Engine.Res.Colors.SKIN2_SELECTEDMENUCOLOR;
  1513.             Color color = this.Engine.Res.Colors.SKIN2_SELECTEDMENUBORDERCOLOR;
  1514.             Color color2 = this.Engine.Res.Colors.SKIN2_SELECTEDMENUCOLOR;
  1515.             int num = _position[0, 8];
  1516.             int num2 = _position[0, 5];
  1517.             int num3 = _position[0, 7];
  1518.             int x = drawRect.Left + num2;
  1519.             int width = (num2 + imageWidth) + num3;
  1520.             int num1 = _position[0, 10];
  1521.             int num17 = _position[0, 11];
  1522.             int num18 = _position[0, 12];
  1523.             int num6 = (drawRect.Right - _position[0, 12]) - _position[0, 11];
  1524.             int num7 = (num6 - _position[0, 10]) - _position[0, 9];
  1525.             if (!xd2a8bb4342ab4ef6.Expansion)
  1526.             {
  1527.                 if (!xd2a8bb4342ab4ef6.Separator)
  1528.                 {
  1529.                     goto Label_0449;
  1530.                 }
  1531.                 if (xd2a8bb4342ab4ef6.VerticalSeparator)
  1532.                 {
  1533.                     using (Pen pen2 = new Pen(ControlPaint.Dark(this.Engine.Res.Colors.SKIN2_MENUITEMCOLOR)))
  1534.                     {
  1535.                         x4b101060f4767186.DrawLine(pen2, drawRect.Left, drawRect.Top, drawRect.Left, drawRect.Bottom);
  1536.                         return;
  1537.                     }
  1538.                 }
  1539.                 Rectangle rectangle4 = new Rectangle(drawRect.Left, drawRect.Top, width, drawRect.Height);
  1540.                 x4b101060f4767186.FillRectangle(Brushes.White, rectangle4);
  1541.                 if (this.Engine.Res.Colors.SKIN2_LEFTBARSTARTCOLOR != this.xcab6a0e662ada486.Res.Colors.SKIN2_LEFTBARENDCOLOR)
  1542.                 {
  1543.                     using (LinearGradientBrush brush4 = new LinearGradientBrush(rectangle4, this.xcab6a0e662ada486.Res.Colors.SKIN2_LEFTBARSTARTCOLOR, this.xcab6a0e662ada486.Res.Colors.SKIN2_LEFTBARENDCOLOR, LinearGradientMode.Horizontal))
  1544.                     {
  1545.                         x4b101060f4767186.FillRectangle(brush4, rectangle4);
  1546.                         goto Label_03E7;
  1547.                     }
  1548.                 }
  1549.                 brush = this.Engine.Res.Brushes.SKIN2_LEFTBARSTARTCOLOR;
  1550.                 x4b101060f4767186.FillRectangle(brush, rectangle4);
  1551.                 goto Label_03E7;
  1552.             }
  1553.             Rectangle rectangle2 = drawRect;
  1554.             rectangle2.X += width;
  1555.             rectangle2.Width -= width;
  1556.             int num8 = rectangle2.Left + ((rectangle2.Width - imageHeight) / 2);
  1557.             int y = rectangle2.Top + ((rectangle2.Height - imageHeight) / 2);
  1558.             if (x15a0329046fb799f)
  1559.             {
  1560.                 Rectangle rectangle3 = new Rectangle(drawRect.Left + 1, drawRect.Top, drawRect.Width - 3, drawRect.Height - 1);
  1561.                 using (Pen pen = new Pen(color))
  1562.                 {
  1563.                     using (SolidBrush brush2 = new SolidBrush(Color.White))
  1564.                     {
  1565.                         x4b101060f4767186.FillRectangle(brush2, rectangle3);
  1566.                     }
  1567.                     using (SolidBrush brush3 = new SolidBrush(color2))
  1568.                     {
  1569.                         x4b101060f4767186.FillRectangle(brush3, rectangle3);
  1570.                         x4b101060f4767186.DrawRectangle(pen, rectangle3);
  1571.                     }
  1572.                     goto Label_029C;
  1573.                 }
  1574.             }
  1575.             brush = this.Engine.Res.Brushes.SKIN2_MENUITEMCOLOR;
  1576.             x4b101060f4767186.FillRectangle(brush, new Rectangle(drawRect.Left + 1, drawRect.Top, drawRect.Width - 1, drawRect.Height));
  1577.             x4b101060f4767186.FillRectangle(Brushes.White, new Rectangle(drawRect.Left, drawRect.Top, width, drawRect.Height));
  1578.             brush = this.Engine.Res.Brushes.SKIN2_LEFTBARSTARTCOLOR;
  1579.             x4b101060f4767186.FillRectangle(brush, new Rectangle(drawRect.Left, drawRect.Top, width, drawRect.Height));
  1580.         Label_029C:
  1581.             x4b101060f4767186.DrawImage(menuImages.Images[6], num8, y);
  1582.             return;
  1583.         Label_03E7:
  1584.             using (Pen pen3 = new Pen(Color.FromArgb(0x4b, this.Engine.Res.Colors.SKIN2_MENUITEMFONTCOLOR)))
  1585.             {
  1586.                 x4b101060f4767186.DrawLine(pen3, (drawRect.Left + width) + num, drawRect.Top + 2, drawRect.Right, drawRect.Top + 2);
  1587.                 return;
  1588.             }
  1589.         Label_0449:
  1590.             num10 = (drawRect.Left + width) + num;
  1591.             if (x15a0329046fb799f)
  1592.             {
  1593.                 Rectangle rectangle5 = new Rectangle(drawRect.Left + 1, drawRect.Top, drawRect.Width - 3, drawRect.Height - 1);
  1594.                 using (Pen pen4 = new Pen(color))
  1595.                 {
  1596.                     using (SolidBrush brush5 = new SolidBrush(Color.White))
  1597.                     {
  1598.                         x4b101060f4767186.FillRectangle(brush5, rectangle5);
  1599.                     }
  1600.                     using (SolidBrush brush6 = new SolidBrush(color2))
  1601.                     {
  1602.                         x4b101060f4767186.FillRectangle(brush6, rectangle5);
  1603.                         x4b101060f4767186.DrawRectangle(pen4, rectangle5);
  1604.                     }
  1605.                     goto Label_069E;
  1606.                 }
  1607.             }
  1608.             brush = this.Engine.Res.Brushes.SKIN2_MENUITEMCOLOR;
  1609.             x4b101060f4767186.FillRectangle(brush, new Rectangle(drawRect.Left + 1, drawRect.Top, drawRect.Width - 1, drawRect.Height));
  1610.             if (xd2a8bb4342ab4ef6.Infrequent && this.highlightInfrequent)
  1611.             {
  1612.                 x4b101060f4767186.FillRectangle(Brushes.White, new Rectangle(num10, drawRect.Top, (drawRect.Right - num10) - num, drawRect.Height));
  1613.                 using (Brush brush7 = new SolidBrush(x448fd9ab43628c71.CalculateColor(this.Engine.Res.Colors.SKIN2_MENUITEMCOLOR, Color.White, 150)))
  1614.                 {
  1615.                     x4b101060f4767186.FillRectangle(brush7, new Rectangle(num10, drawRect.Top, (drawRect.Right - num10) - num, drawRect.Height));
  1616.                 }
  1617.             }
  1618.             Rectangle rect = new Rectangle(drawRect.Left, drawRect.Top, width, drawRect.Height);
  1619.             x4b101060f4767186.FillRectangle(Brushes.White, rect);
  1620.             if (this.Engine.Res.Colors.SKIN2_LEFTBARSTARTCOLOR != this.Engine.Res.Colors.SKIN2_LEFTBARENDCOLOR)
  1621.             {
  1622.                 using (LinearGradientBrush brush8 = new LinearGradientBrush(rect, this.xcab6a0e662ada486.Res.Colors.SKIN2_LEFTBARSTARTCOLOR, this.xcab6a0e662ada486.Res.Colors.SKIN2_LEFTBARENDCOLOR, LinearGradientMode.Horizontal))
  1623.                 {
  1624.                     x4b101060f4767186.FillRectangle(brush8, rect);
  1625.                     goto Label_069E;
  1626.                 }
  1627.             }
  1628.             brush = this.Engine.Res.Brushes.SKIN2_LEFTBARSTARTCOLOR;
  1629.             x4b101060f4767186.FillRectangle(brush, rect);
  1630.         Label_069E:
  1631.             rectangle7 = new Rectangle(num10, drawRect.Top, num7 - num10, drawRect.Height);
  1632.             StringFormat format = new StringFormat();
  1633.             format.FormatFlags = StringFormatFlags.NoClip | StringFormatFlags.NoWrap;
  1634.             if ((this.parentControl != null) && ((this.parentControl.RightToLeft & RightToLeft.Yes) == RightToLeft.Yes))
  1635.             {
  1636.                 format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
  1637.             }
  1638.             if ((this.x94975a4c4f1d71c4 & RightToLeft.Yes) == RightToLeft.Yes)
  1639.             {
  1640.                 format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
  1641.             }
  1642.             format.Alignment = StringAlignment.Near;
  1643.             format.LineAlignment = StringAlignment.Center;
  1644.             format.HotkeyPrefix = HotkeyPrefix.Show;
  1645.             if (x15a0329046fb799f)
  1646.             {
  1647.                 brush9 = new SolidBrush(this.Engine.Res.Colors.SKIN2_SELECTEDMENUFONTCOLOR);
  1648.             }
  1649.             else if (menuCommand.Enabled)
  1650.             {
  1651.                 brush9 = new SolidBrush(this.Engine.Res.Colors.SKIN2_MENUITEMFONTCOLOR);
  1652.             }
  1653.             else
  1654.             {
  1655.                 brush9 = new SolidBrush(SystemColors.GrayText);
  1656.             }
  1657.             rectangle7.Offset(1, 1);
  1658.             x4b101060f4767186.DrawString(menuCommand.Text, this.textFont, brush9, rectangle7, format);
  1659.             if (menuCommand.Shortcut != Shortcut.None)
  1660.             {
  1661.                 format.Alignment = StringAlignment.Far;
  1662.                 if (menuCommand.Enabled)
  1663.                 {
  1664.                     x4b101060f4767186.DrawString(this.x8cf43133d25d686a(menuCommand.Shortcut), this.textFont, brush9, rectangle7, format);
  1665.                 }
  1666.                 else
  1667.                 {
  1668.                     x4b101060f4767186.DrawString(this.x8cf43133d25d686a(menuCommand.Shortcut), this.textFont, brush9, rectangle7, format);
  1669.                 }
  1670.             }
  1671.             int num11 = drawRect.Top + ((drawRect.Height - imageHeight) / 2);
  1672.             Image image = null;
  1673.             if (menuCommand.Checked)
  1674.             {
  1675.                 Pen pen5;
  1676.                 Brush brush10;
  1677.                 if (menuCommand.Enabled)
  1678.                 {
  1679.                     pen5 = new Pen(color);
  1680.                     brush10 = new SolidBrush(Color.FromArgb(20, this.Engine.Res.Colors.SKIN2_SELECTEDMENUBORDERCOLOR));
  1681.                 }
  1682.                 else
  1683.                 {
  1684.                     pen5 = new Pen(SystemColors.GrayText);
  1685.                     brush10 = new SolidBrush(Color.FromArgb(20, SystemColors.GrayText));
  1686.                 }
  1687.                 Rectangle rectangle9 = new Rectangle(x - 1, num11 - 1, imageHeight + 2, imageWidth + 2);
  1688.                 x4b101060f4767186.FillRectangle(brush10, rectangle9);
  1689.                 x4b101060f4767186.DrawRectangle(pen5, rectangle9);
  1690.                 pen5.Dispose();
  1691.                 brush10.Dispose();
  1692.                 if (menuCommand.RadioCheck)
  1693.                 {
  1694.                     image = menuImages.Images[1];
  1695.                 }
  1696.                 else
  1697.                 {
  1698.                     image = this.Engine.Res.Bitmaps.SKIN2_CHECKEDMENUICON;
  1699.                 }
  1700.             }
  1701.             else
  1702.             {
  1703.                 try
  1704.                 {
  1705.                     if (menuCommand.Image != null)
  1706.                     {
  1707.                         image = menuCommand.Image;
  1708.                     }
  1709.                     else if ((menuCommand.ImageList != null) && (menuCommand.ImageIndex >= 0))
  1710.                     {
  1711.                         image = menuCommand.ImageList.Images[menuCommand.ImageIndex];
  1712.                     }
  1713.                 }
  1714.                 catch (Exception)
  1715.                 {
  1716.                     image = menuImages.Images[7];
  1717.                 }
  1718.             }
  1719.             if (image != null)
  1720.             {
  1721.                 if (menuCommand.Enabled)
  1722.                 {
  1723.                     if (x15a0329046fb799f && !menuCommand.Checked)
  1724.                     {
  1725.                         Bitmap bitmap = new Bitmap((Bitmap) image);
  1726.                         Color color3 = Color.FromArgb(0x9a, 0x9c, 0x92);
  1727.                         Color color4 = Color.FromArgb(0, 0, 0, 0);
  1728.                         for (int i = 0; i < image.Width; i++)
  1729.                         {
  1730.                             for (int j = 0; j < image.Height; j++)
  1731.                             {
  1732.                                 if (bitmap.GetPixel(i, j) != color4)
  1733.                                 {
  1734.                                     bitmap.SetPixel(i, j, color3);
  1735.                                 }
  1736.                             }
  1737.                         }
  1738.                         x4b101060f4767186.DrawImage(bitmap, (int) (x + 1), (int) (num11 + 1));
  1739.                         x4b101060f4767186.DrawImage(image, (int) (x - 1), (int) (num11 - 1));
  1740.                     }
  1741.                     else
  1742.                     {
  1743.                         Bitmap bitmap2 = new Bitmap(image);
  1744.                         Color color5 = Color.FromArgb(0, 0, 0, 0);
  1745.                         for (int k = 0; k < image.Width; k++)
  1746.                         {
  1747.                             for (int m = 0; m < image.Height; m++)
  1748.                             {
  1749.                                 Color pixel = bitmap2.GetPixel(k, m);
  1750.                                 if (pixel != color5)
  1751.                                 {
  1752.                                     Color color7 = Color.FromArgb((pixel.R + 0x4c) - (((pixel.R + 0x20) / 0x40) * 0x13), (pixel.G + 0x4c) - (((pixel.G + 0x20) / 0x40) * 0x13), (pixel.B + 0x4c) - (((pixel.B + 0x20) / 0x40) * 0x13));
  1753.                                     bitmap2.SetPixel(k, m, color7);
  1754.                                 }
  1755.                             }
  1756.                         }
  1757.                         x4b101060f4767186.DrawImage(bitmap2, x, num11);
  1758.                     }
  1759.                 }
  1760.                 else
  1761.                 {
  1762.                     ControlPaint.DrawImageDisabled(x4b101060f4767186, image, x, num11, SystemColors.HighlightText);
  1763.                 }
  1764.             }
  1765.             if (xd2a8bb4342ab4ef6.SubMenu)
  1766.             {
  1767.                 if (menuCommand.Enabled)
  1768.                 {
  1769.                     int num16 = 2;
  1770.                     x4b101060f4767186.DrawImage(menuImages.Images[num16], num6, num11);
  1771.                 }
  1772.                 else
  1773.                 {
  1774.                     ControlPaint.DrawImageDisabled(x4b101060f4767186, menuImages.Images[2], num6, num11, this.Engine.Res.Colors.SKIN2_SELECTEDMENUFONTCOLOR);
  1775.                 }
  1776.             }
  1777.         }
  1778.         protected void xb97e8a8020dddaac()
  1779.         {
  1780.             if (this.childMenu != null)
  1781.             {
  1782.                 x61467fe65a98f20c.PostMessage(this.childMenu.Handle, this.WM_DISMISS, (uint) 0, (uint) 0);
  1783.             }
  1784.             this.returnCommand = null;
  1785.             this.timer.Stop();
  1786.             this.exitLoop = true;
  1787.             this.x4139e66e6dfaac52();
  1788.             this.DestroyHandle();
  1789.         }
  1790.         protected void xbcf8eb07b7e76a62(ref Message x6088325dec1baa2a)
  1791.         {
  1792.             x555516122dcc901e.POINT point;
  1793.             x555516122dcc901e.POINT point2;
  1794.             int wParam = (int) x6088325dec1baa2a.WParam;
  1795.             bool flag = x6088325dec1baa2a.LParam != IntPtr.Zero;
  1796.             this.popupItem = wParam;
  1797.             this.childMenu = new x902c4aee45bfd906(this.Engine);
  1798.             x2cc390e9409b0f3f xccebff = this.drawCommands[wParam] as x2cc390e9409b0f3f;
  1799.             point.x = xccebff.DrawRect.Right;
  1800.             point.y = xccebff.DrawRect.Top;
  1801.             x61467fe65a98f20c.ClientToScreen(base.Handle, ref point);
  1802.             point2.x = xccebff.DrawRect.Left;
  1803.             point2.y = xccebff.DrawRect.Top;
  1804.             x61467fe65a98f20c.ClientToScreen(base.Handle, ref point2);
  1805.             this.childMenu.Font = this.Font;
  1806.             this.childMenu.Animate = this.Animate;
  1807.             this.childMenu.AnimateStyle = this.AnimateStyle;
  1808.             this.childMenu.AnimateTime = this.AnimateTime;
  1809.             int num2 = 0;
  1810.             this.childMenu.RememberExpansion = this.rememberExpansion;
  1811.             this.childMenu.showInfrequent = xccebff.MenuCommand.MenuCommands.ShowInfrequent;
  1812.             this.childMenu.HighlightInfrequent = this.highlightInfrequent;
  1813.             xccebff.MenuCommand.OnPopupStart();
  1814.             this.returnCommand = this.childMenu.x6e4244e25732db7d(new Point(point.x, point.y), new Point(point2.x, point2.y), xccebff.MenuCommand.MenuCommands, this, flag, this.parentControl, this.popupRight, this.popupDown, this.animateFirst, ref num2);
  1815.             xccebff.MenuCommand.OnPopupEnd();
  1816.             wParam = -1;
  1817.             this.childMenu = null;
  1818.             this.animateFirst = false;
  1819.             if ((this.returnCommand != null) || (num2 != 0))
  1820.             {
  1821.                 this.timer.Stop();
  1822.                 this.exitLoop = true;
  1823.                 this.returnDir = num2;
  1824.             }
  1825.         }
  1826.         protected x902c4aee45bfd906 xcb534454d6825379(x555516122dcc901e.POINT x0ce73f6cbd7d5515)
  1827.         {
  1828.             xae4dd1cafd2eb77c.RECT lpRect = new xae4dd1cafd2eb77c.RECT();
  1829.             x61467fe65a98f20c.GetWindowRect(base.Handle, ref lpRect);
  1830.             if (((x0ce73f6cbd7d5515.x >= lpRect.left) && (x0ce73f6cbd7d5515.x <= lpRect.right)) && ((x0ce73f6cbd7d5515.y >= lpRect.top) && (x0ce73f6cbd7d5515.y <= lpRect.bottom)))
  1831.             {
  1832.                 return this;
  1833.             }
  1834.             if (this.parentMenu != null)
  1835.             {
  1836.                 return this.parentMenu.xcb534454d6825379(x0ce73f6cbd7d5515);
  1837.             }
  1838.             return null;
  1839.         }
  1840.         protected void xcea282a46787878f(Graphics x4b101060f4767186, int xa447fc54e41dfe06, int xc941868c59399d3e, int x9b0739496f8b5475, int x4d5aabc7a55b12ba, xf398ffaf32ffe055 x9c9eac3a36336680)
  1841.         {
  1842.             if (this.layered)
  1843.             {
  1844.                 Color color = Color.FromArgb(0x40, 0, 0, 0);
  1845.                 Color color2 = Color.FromArgb(0x30, 0, 0, 0);
  1846.                 Color color3 = Color.FromArgb(0, 0, 0, 0);
  1847.                 if ((x9c9eac3a36336680 != xf398ffaf32ffe055.Right) && (x9b0739496f8b5475 >= shadowLength))
  1848.                 {
  1849.                     using (LinearGradientBrush brush = new LinearGradientBrush(new Point(xa447fc54e41dfe06 + shadowLength, xc941868c59399d3e - shadowLength), new Point(xa447fc54e41dfe06, xc941868c59399d3e + x4d5aabc7a55b12ba), color, color3))
  1850.                     {
  1851.                         x4b101060f4767186.FillRectangle(brush, xa447fc54e41dfe06, xc941868c59399d3e, shadowLength, x4d5aabc7a55b12ba);
  1852.                         xa447fc54e41dfe06 += shadowLength;
  1853.                         x9b0739496f8b5475 -= shadowLength;
  1854.                     }
  1855.                 }
  1856.                 if ((x9c9eac3a36336680 != xf398ffaf32ffe055.Left) && (x9b0739496f8b5475 >= shadowLength))
  1857.                 {
  1858.                     try
  1859.                     {
  1860.                         x4b101060f4767186.DrawImageUnscaled(x7ca9c34ba153ef81(shadowLength, x4d5aabc7a55b12ba), (xa447fc54e41dfe06 + x9b0739496f8b5475) - shadowLength, xc941868c59399d3e);
  1861.                     }
  1862.                     catch
  1863.                     {
  1864.                     }
  1865.                     x9b0739496f8b5475 -= shadowLength;
  1866.                 }
  1867.                 using (LinearGradientBrush brush2 = new LinearGradientBrush(new Point(0x270f, xc941868c59399d3e), new Point(0x270f, xc941868c59399d3e + x4d5aabc7a55b12ba), color2, color3))
  1868.                 {
  1869.                     x4b101060f4767186.FillRectangle(brush2, xa447fc54e41dfe06, xc941868c59399d3e, x9b0739496f8b5475, x4d5aabc7a55b12ba);
  1870.                     return;
  1871.                 }
  1872.             }
  1873.             using (SolidBrush brush3 = new SolidBrush(ControlPaint.Dark(this.Engine.Res.Colors.SKIN2_MENUITEMCOLOR)))
  1874.             {
  1875.                 x4b101060f4767186.FillRectangle(brush3, xa447fc54e41dfe06, xc941868c59399d3e, x9b0739496f8b5475, x4d5aabc7a55b12ba);
  1876.             }
  1877.         }
  1878.         protected void xd6cfa3f3f3125e82(int x75cf7df8c59ffa4d, int xc13ed6de98262a2d)
  1879.         {
  1880.             x75cf7df8c59ffa4d -= this.currentPoint.X;
  1881.             xc13ed6de98262a2d -= this.currentPoint.Y;
  1882.             Point pt = new Point(x75cf7df8c59ffa4d, xc13ed6de98262a2d);
  1883.             for (int i = 0; i < this.drawCommands.Count; i++)
  1884.             {
  1885.                 x2cc390e9409b0f3f xccebff = this.drawCommands[i] as x2cc390e9409b0f3f;
  1886.                 if (xccebff.DrawRect.Contains(pt) && (this.trackItem != i))
  1887.                 {
  1888.                     this.xeb515a5b77846afe(this.trackItem, i, false, false);
  1889.                 }
  1890.             }
  1891.             if (this.trackItem != -1)
  1892.             {
  1893.                 x2cc390e9409b0f3f xccebff2 = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  1894.                 if (xccebff2.SubMenu)
  1895.                 {
  1896.                     if (this.popupItem != this.trackItem)
  1897.                     {
  1898.                         if (this.childMenu != null)
  1899.                         {
  1900.                             x61467fe65a98f20c.PostMessage(this.childMenu.Handle, this.WM_DISMISS, (uint) 0, (uint) 0);
  1901.                         }
  1902.                         this.x0760506d6abf77a2(this.trackItem, false);
  1903.                     }
  1904.                 }
  1905.                 else if (xccebff2.Expansion)
  1906.                 {
  1907.                     this.x057464a452da34b7();
  1908.                 }
  1909.                 else
  1910.                 {
  1911.                     if (this.childMenu != null)
  1912.                     {
  1913.                         x61467fe65a98f20c.PostMessage(this.childMenu.Handle, this.WM_DISMISS, (uint) 0, (uint) 0);
  1914.                     }
  1915.                     this.returnCommand = xccebff2.MenuCommand;
  1916.                     this.timer.Stop();
  1917.                     this.exitLoop = true;
  1918.                 }
  1919.             }
  1920.         }
  1921.         protected bool xddec9c21ef58186c(ref Message x6088325dec1baa2a)
  1922.         {
  1923.             x555516122dcc901e.POINT point;
  1924.             x555516122dcc901e.POINT point2;
  1925.             point.x = (short) (((int) x6088325dec1baa2a.LParam) & 0xffff);
  1926.             point.y = (short) ((((int) x6088325dec1baa2a.LParam) & -65536) >> 0x10);
  1927.             point2.x = this.currentSize.Width - _position[0, 0x10];
  1928.             point2.y = this.currentSize.Height - _position[0, 0x11];
  1929.             x61467fe65a98f20c.ClientToScreen(base.Handle, ref point2);
  1930.             if ((point.x <= point2.x) && (point.y <= point2.y))
  1931.             {
  1932.                 return false;
  1933.             }
  1934.             x6088325dec1baa2a.Result = (IntPtr) (-1);
  1935.             return true;
  1936.         }
  1937.         protected void xe145f7beb24da7f5(Graphics x4b101060f4767186, Rectangle x04a925412b1bb508)
  1938.         {
  1939.             Rectangle rect = new Rectangle(x04a925412b1bb508.Left, x04a925412b1bb508.Top, this.extraSize - _position[0, 20], x04a925412b1bb508.Height);
  1940.             Brush extraBackBrush = null;
  1941.             bool flag = true;
  1942.             if (this.menuCommands.ExtraBackBrush != null)
  1943.             {
  1944.                 extraBackBrush = this.menuCommands.ExtraBackBrush;
  1945.                 flag = false;
  1946.                 rect.Width++;
  1947.             }
  1948.             else
  1949.             {
  1950.                 extraBackBrush = new SolidBrush(this.menuCommands.ExtraBackColor);
  1951.             }
  1952.             x4b101060f4767186.FillRectangle(extraBackBrush, rect);
  1953.             if (flag)
  1954.             {
  1955.                 extraBackBrush.Dispose();
  1956.             }
  1957.             rect.X += _position[0, 0x12];
  1958.             rect.Y += _position[0, 0x13];
  1959.             rect.Width -= _position[0, 0x12] * 2;
  1960.             rect.Height -= _position[0, 0x13] * 2;
  1961.             StringFormat drawFormat = new StringFormat();
  1962.             drawFormat.FormatFlags = StringFormatFlags.NoClip | StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;
  1963.             drawFormat.Alignment = StringAlignment.Near;
  1964.             drawFormat.LineAlignment = StringAlignment.Center;
  1965.             Brush drawBrush = null;
  1966.             bool flag2 = true;
  1967.             if (this.menuCommands.ExtraTextBrush != null)
  1968.             {
  1969.                 drawBrush = this.menuCommands.ExtraTextBrush;
  1970.                 flag2 = false;
  1971.             }
  1972.             else
  1973.             {
  1974.                 drawBrush = new SolidBrush(this.menuCommands.ExtraTextColor);
  1975.             }
  1976.             x957e371151765ec5.DrawReverseString(x4b101060f4767186, this.menuCommands.ExtraText, this.menuCommands.ExtraFont, rect, drawBrush, drawFormat);
  1977.             if (flag2)
  1978.             {
  1979.                 drawBrush.Dispose();
  1980.             }
  1981.         }
  1982.         protected void xe75f29bc258e83bf(Graphics x4b101060f4767186, int xa447fc54e41dfe06, int xc941868c59399d3e, int x9b0739496f8b5475, int x4d5aabc7a55b12ba)
  1983.         {
  1984.             if (this.layered)
  1985.             {
  1986.                 Color color = Color.FromArgb(0x40, 0, 0, 0);
  1987.                 Color color2 = Color.FromArgb(0x30, 0, 0, 0);
  1988.                 Color color3 = Color.FromArgb(0, 0, 0, 0);
  1989.                 if (x4d5aabc7a55b12ba >= shadowLength)
  1990.                 {
  1991.                     using (LinearGradientBrush brush = new LinearGradientBrush(new Point(xa447fc54e41dfe06 - shadowLength, xc941868c59399d3e + shadowLength), new Point(xa447fc54e41dfe06 + shadowLength, xc941868c59399d3e), color, color3))
  1992.                     {
  1993.                         x4b101060f4767186.FillRectangle(brush, xa447fc54e41dfe06, xc941868c59399d3e, shadowLength, shadowLength);
  1994.                         xc941868c59399d3e += shadowLength;
  1995.                         x4d5aabc7a55b12ba -= shadowLength;
  1996.                     }
  1997.                 }
  1998.                 using (LinearGradientBrush brush2 = new LinearGradientBrush(new Point(xa447fc54e41dfe06, 0), new Point(xa447fc54e41dfe06 + x9b0739496f8b5475, 0), color2, color3))
  1999.                 {
  2000.                     x4b101060f4767186.FillRectangle(brush2, xa447fc54e41dfe06, xc941868c59399d3e, x9b0739496f8b5475, x4d5aabc7a55b12ba + 1);
  2001.                     return;
  2002.                 }
  2003.             }
  2004.             using (SolidBrush brush3 = new SolidBrush(ControlPaint.Dark(this.Engine.Res.Colors.SKIN2_MENUITEMCOLOR)))
  2005.             {
  2006.                 x4b101060f4767186.FillRectangle(brush3, xa447fc54e41dfe06, xc941868c59399d3e, x9b0739496f8b5475, x4d5aabc7a55b12ba + 1);
  2007.             }
  2008.         }
  2009.         protected void xeb515a5b77846afe(int x5360a38cdebd0e93, int x169940ac3300e3e7, bool xaca68b9c5e07af12, bool xb2ad27288bcb93e7)
  2010.         {
  2011.             bool flag = false;
  2012.             using (Graphics graphics = Graphics.FromHwnd(base.Handle))
  2013.             {
  2014.                 if (x5360a38cdebd0e93 != -1)
  2015.                 {
  2016.                     x2cc390e9409b0f3f xccebff = this.drawCommands[x5360a38cdebd0e93] as x2cc390e9409b0f3f;
  2017.                     if (this.layered)
  2018.                     {
  2019.                         flag = true;
  2020.                     }
  2021.                     else
  2022.                     {
  2023.                         this.xb5a5bdae3ba8936b(graphics, this.drawCommands[x5360a38cdebd0e93] as x2cc390e9409b0f3f, false);
  2024.                     }
  2025.                     if (xccebff.MenuCommand != null)
  2026.                     {
  2027.                         this.OnDeselected(xccebff.MenuCommand);
  2028.                     }
  2029.                 }
  2030.                 if (x169940ac3300e3e7 != -1)
  2031.                 {
  2032.                     this.timer.Stop();
  2033.                     if (!xb2ad27288bcb93e7 && (this.childMenu != null))
  2034.                     {
  2035.                         this.timer.Interval = selectionDelay;
  2036.                         this.timer.Start();
  2037.                     }
  2038.                     x2cc390e9409b0f3f xccebff2 = this.drawCommands[x169940ac3300e3e7] as x2cc390e9409b0f3f;
  2039.                     if (!xccebff2.Separator && xccebff2.Enabled)
  2040.                     {
  2041.                         if (this.layered)
  2042.                         {
  2043.                             flag = true;
  2044.                         }
  2045.                         else
  2046.                         {
  2047.                             this.xb5a5bdae3ba8936b(graphics, xccebff2, true);
  2048.                         }
  2049.                         if (!xb2ad27288bcb93e7 && xaca68b9c5e07af12)
  2050.                         {
  2051.                             if (xccebff2.Expansion)
  2052.                             {
  2053.                                 this.timer.Interval = expansionDelay;
  2054.                             }
  2055.                             else
  2056.                             {
  2057.                                 this.timer.Interval = selectionDelay;
  2058.                             }
  2059.                             this.timer.Start();
  2060.                         }
  2061.                         if (xccebff2.MenuCommand != null)
  2062.                         {
  2063.                             this.OnSelected(xccebff2.MenuCommand);
  2064.                         }
  2065.                     }
  2066.                     else
  2067.                     {
  2068.                         x169940ac3300e3e7 = -1;
  2069.                     }
  2070.                 }
  2071.                 this.trackItem = x169940ac3300e3e7;
  2072.                 if (this.layered && flag)
  2073.                 {
  2074.                     this.x9119fce83e4631ad();
  2075.                 }
  2076.             }
  2077.         }
  2078.         protected void xf1420593eaecc724(bool x789c645a15deb49b)
  2079.         {
  2080.             this.x9119fce83e4631ad(0);
  2081.             x61467fe65a98f20c.ShowWindow(base.Handle, 4);
  2082.             int num = this.animateTime / blendSteps;
  2083.             for (int i = 0; i < blendSteps; i++)
  2084.             {
  2085.                 byte num3 = (byte) (0x3f + ((0xc0 / blendSteps) * (i + 1)));
  2086.                 DateTime now = DateTime.Now;
  2087.                 this.x9119fce83e4631ad(num3);
  2088.                 TimeSpan span = DateTime.Now.Subtract(now);
  2089.                 if ((this.animateTime > 0) && (span.Milliseconds < num))
  2090.                 {
  2091.                     Thread.Sleep((int) (num - span.Milliseconds));
  2092.                 }
  2093.             }
  2094.         }
  2095.         protected x5f4b657f68f87baa xf1c4e2176aec0ad6(bool xacc37ebdd71fcc44)
  2096.         {
  2097.             try
  2098.             {
  2099.                 this.returnCommand = null;
  2100.                 this.trackItem = -1;
  2101.                 this.exitLoop = false;
  2102.                 this.mouseOver = false;
  2103.                 this.returnDir = 0;
  2104.                 bool flag = false;
  2105.                 this.animateFirst = true;
  2106.                 this.xa1715c5212ff8a33();
  2107.                 x40255b11ef821fa3.MSG msg = new x40255b11ef821fa3.MSG();
  2108.                 if (xacc37ebdd71fcc44)
  2109.                 {
  2110.                     this.x5b2e42a68d835b31();
  2111.                 }
  2112.                 x61467fe65a98f20c.SetCursor(x61467fe65a98f20c.LoadCursor(IntPtr.Zero, 0x7f00));
  2113.                 bool flag2 = x61467fe65a98f20c.HideCaret(IntPtr.Zero);
  2114.                 while (!this.exitLoop)
  2115.                 {
  2116.                     if (!x61467fe65a98f20c.WaitMessage())
  2117.                     {
  2118.                         continue;
  2119.                     }
  2120.                     while (!this.exitLoop && x61467fe65a98f20c.PeekMessage(ref msg, 0, 0, 0, 0))
  2121.                     {
  2122.                         int num3;
  2123.                         bool flag3 = false;
  2124.                         int num = this.currentSize.Width - _position[0, 0x10];
  2125.                         int num2 = this.currentSize.Height - _position[0, 0x11];
  2126.                         if ((((msg.message == 0x202) || (msg.message == 520)) || ((msg.message == 0x205) || (msg.message == 0x20c))) || (((msg.message == 0xa2) || (msg.message == 0xa8)) || ((msg.message == 0xa5) || (msg.message == 0xac))))
  2127.                         {
  2128.                             x555516122dcc901e.POINT point = this.x4b688849d80162f6(msg);
  2129.                             if (((point.x >= this.currentPoint.X) && (point.x <= (this.currentPoint.X + num))) && ((point.y >= this.currentPoint.Y) && (point.y <= (this.currentPoint.Y + num2))))
  2130.                             {
  2131.                                 this.xd6cfa3f3f3125e82(point.x, point.y);
  2132.                                 flag3 = true;
  2133.                             }
  2134.                             else
  2135.                             {
  2136.                                 x902c4aee45bfd906 xcaeebfd = this.x3c6f7570c20e3f7d(point, ref msg);
  2137.                                 if (xcaeebfd != null)
  2138.                                 {
  2139.                                     xcaeebfd.xd6cfa3f3f3125e82(point.x, point.y);
  2140.                                     flag3 = true;
  2141.                                 }
  2142.                             }
  2143.                         }
  2144.                         if ((((msg.message == 0x201) || (msg.message == 0x207)) || ((msg.message == 0x204) || (msg.message == 0x20b))) || (((msg.message == 0xa1) || (msg.message == 0xa7)) || ((msg.message == 0xa4) || (msg.message == 0xab))))
  2145.                         {
  2146.                             x555516122dcc901e.POINT point2 = this.x4b688849d80162f6(msg);
  2147.                             if (((point2.x >= this.currentPoint.X) && (point2.x <= (this.currentPoint.X + num))) && ((point2.y >= this.currentPoint.Y) && (point2.y <= (this.currentPoint.Y + num2))))
  2148.                             {
  2149.                                 flag3 = true;
  2150.                             }
  2151.                             else if (this.x3c6f7570c20e3f7d(point2, ref msg) == null)
  2152.                             {
  2153.                                 if (this.x277ff37e12aff68b(point2, ref msg))
  2154.                                 {
  2155.                                     this.parentControl.x2ea07c3ab5d970d4(point2);
  2156.                                     flag3 = true;
  2157.                                 }
  2158.                                 else
  2159.                                 {
  2160.                                     this.exitLoop = true;
  2161.                                     flag = true;
  2162.                                     if ((this.parentControl != null) && (msg.hwnd == this.parentControl.Handle))
  2163.                                     {
  2164.                                         flag = false;
  2165.                                     }
  2166.                                 }
  2167.                             }
  2168.                             else
  2169.                             {
  2170.                                 flag3 = true;
  2171.                             }
  2172.                         }
  2173.                         if (msg.message == 0x200)
  2174.                         {
  2175.                             x555516122dcc901e.POINT point3 = this.x4b688849d80162f6(msg);
  2176.                             if (((point3.x >= this.currentPoint.X) && (point3.x <= (this.currentPoint.X + num))) && ((point3.y >= this.currentPoint.Y) && (point3.y <= (this.currentPoint.Y + num2))))
  2177.                             {
  2178.                                 this.x136735fdfe6d04ea(point3.x, point3.y);
  2179.                             }
  2180.                             else
  2181.                             {
  2182.                                 if (this.mouseOver)
  2183.                                 {
  2184.                                     this.xa84c74b103039157();
  2185.                                 }
  2186.                                 x902c4aee45bfd906 xcaeebfd2 = this.x3c6f7570c20e3f7d(point3, ref msg);
  2187.                                 if (xcaeebfd2 != null)
  2188.                                 {
  2189.                                     xcaeebfd2.x136735fdfe6d04ea(point3.x, point3.y);
  2190.                                 }
  2191.                                 else if (this.x277ff37e12aff68b(point3, ref msg))
  2192.                                 {
  2193.                                     this.parentControl.x136735fdfe6d04ea(point3);
  2194.                                 }
  2195.                             }
  2196.                             flag3 = true;
  2197.                         }
  2198.                         if (msg.message == 0x20)
  2199.                         {
  2200.                             this.x773209141f430902();
  2201.                             flag3 = true;
  2202.                         }
  2203.                         if (msg.message == 260)
  2204.                         {
  2205.                             if (((int) msg.wParam) == 0x12)
  2206.                             {
  2207.                                 this.exitLoop = true;
  2208.                             }
  2209.                             else
  2210.                             {
  2211.                                 msg.message = 0x100;
  2212.                             }
  2213.                         }
  2214.                         if (msg.message == 0x100)
  2215.                         {
  2216.                             int wParam = (int) msg.wParam;
  2217.                             if (wParam != 13)
  2218.                             {
  2219.                                 switch (wParam)
  2220.                                 {
  2221.                                     case 0x25:
  2222.                                         this.x0e37e200024f43ba();
  2223.                                         goto Label_0543;
  2224.                                     case 0x26:
  2225.                                         this.x5437d760e9a6340b();
  2226.                                         goto Label_0543;
  2227.                                     case 0x27:
  2228.                                         if (this.xb2aa7fc859b3d5b7())
  2229.                                         {
  2230.                                             flag = true;
  2231.                                         }
  2232.                                         goto Label_0543;
  2233.                                     case 40:
  2234.                                         this.x5b2e42a68d835b31();
  2235.                                         goto Label_0543;
  2236.                                     case 0x1b:
  2237.                                         goto Label_04F6;
  2238.                                 }
  2239.                                 goto Label_04FF;
  2240.                             }
  2241.                             if (this.trackItem != -1)
  2242.                             {
  2243.                                 x2cc390e9409b0f3f xccebff = this.drawCommands[this.trackItem] as x2cc390e9409b0f3f;
  2244.                                 if (xccebff.SubMenu)
  2245.                                 {
  2246.                                     this.x0760506d6abf77a2(this.trackItem, false);
  2247.                                     flag = true;
  2248.                                 }
  2249.                                 else if (xccebff.Expansion)
  2250.                                 {
  2251.                                     this.x057464a452da34b7();
  2252.                                 }
  2253.                                 else
  2254.                                 {
  2255.                                     this.returnCommand = xccebff.MenuCommand;
  2256.                                     this.exitLoop = true;
  2257.                                 }
  2258.                             }
  2259.                         }
  2260.                         goto Label_0543;
  2261.                     Label_04F6:
  2262.                         this.exitLoop = true;
  2263.                         goto Label_0543;
  2264.                     Label_04FF:
  2265.                         num3 = this.x65c1cc54cc8b0e75((char) ((int) msg.wParam));
  2266.                         if (num3 != -1)
  2267.                         {
  2268.                             x2cc390e9409b0f3f xccebff2 = this.drawCommands[num3] as x2cc390e9409b0f3f;
  2269.                             this.returnCommand = xccebff2.MenuCommand;
  2270.                             this.exitLoop = true;
  2271.                             flag = true;
  2272.                         }
  2273.                     Label_0543:
  2274.                         if (((msg.message == 0x100) || (msg.message == 0x101)) || ((msg.message == 260) || (msg.message == 0x105)))
  2275.                         {
  2276.                             flag3 = true;
  2277.                         }
  2278.                         if (flag3)
  2279.                         {
  2280.                             x40255b11ef821fa3.MSG lpMsg = new x40255b11ef821fa3.MSG();
  2281.                             x61467fe65a98f20c.GetMessage(ref lpMsg, IntPtr.Zero, 0, 0);
  2282.                         }
  2283.                         else
  2284.                         {
  2285.                             if (!flag)
  2286.                             {
  2287.                                 if (x61467fe65a98f20c.GetMessage(ref msg, IntPtr.Zero, 0, 0))
  2288.                                 {
  2289.                                     x61467fe65a98f20c.TranslateMessage(ref msg);
  2290.                                     x61467fe65a98f20c.DispatchMessage(ref msg);
  2291.                                 }
  2292.                                 continue;
  2293.                             }
  2294.                             flag = false;
  2295.                         }
  2296.                     }
  2297.                 }
  2298.                 if (flag2)
  2299.                 {
  2300.                     x61467fe65a98f20c.ShowCaret(IntPtr.Zero);
  2301.                 }
  2302.                 this.xeb515a5b77846afe(this.trackItem, -1, false, false);
  2303.                 this.x4139e66e6dfaac52();
  2304.                 this.DestroyHandle();
  2305.                 if (((this.parentMenu == null) && (this.returnCommand != null)) && (this.parentControl == null))
  2306.                 {
  2307.                     this.returnCommand.OnClick(EventArgs.Empty);
  2308.                 }
  2309.                 return this.returnCommand;
  2310.             }
  2311.             catch (Exception)
  2312.             {
  2313.                 return null;
  2314.             }
  2315.         }
  2316.         protected void xfbe050c2d5b2be39(ArrayList x607ab5024f65c83d, int xc529a6810c5d3b0c)
  2317.         {
  2318.             foreach (x2cc390e9409b0f3f xccebff in x607ab5024f65c83d)
  2319.             {
  2320.                 Rectangle drawRect = xccebff.DrawRect;
  2321.                 xccebff.DrawRect = new Rectangle(drawRect.Left, drawRect.Top, xc529a6810c5d3b0c, drawRect.Height);
  2322.             }
  2323.             x607ab5024f65c83d.Clear();
  2324.         }
  2325.         public x6fd23f8bad2f3ced Animate
  2326.         {
  2327.             get
  2328.             {
  2329.                 return this.animateItem;
  2330.             }
  2331.             set
  2332.             {
  2333.                 this.animateItem = value;
  2334.             }
  2335.         }
  2336.         public x1f5697535eab37b9 AnimateStyle
  2337.         {
  2338.             get
  2339.             {
  2340.                 return this.animateStyle;
  2341.             }
  2342.             set
  2343.             {
  2344.                 this.animateStyle = value;
  2345.             }
  2346.         }
  2347.         public int AnimateTime
  2348.         {
  2349.             get
  2350.             {
  2351.                 return this.animateTime;
  2352.             }
  2353.             set
  2354.             {
  2355.                 this.animateTime = value;
  2356.             }
  2357.         }
  2358.         public SkinEngine Engine
  2359.         {
  2360.             get
  2361.             {
  2362.                 return this.xcab6a0e662ada486;
  2363.             }
  2364.             set
  2365.             {
  2366.                 this.xcab6a0e662ada486 = value;
  2367.             }
  2368.         }
  2369.         public System.Drawing.Font Font
  2370.         {
  2371.             get
  2372.             {
  2373.                 return this.textFont;
  2374.             }
  2375.             set
  2376.             {
  2377.                 this.textFont = value;
  2378.             }
  2379.         }
  2380.         public bool HighlightInfrequent
  2381.         {
  2382.             get
  2383.             {
  2384.                 return this.highlightInfrequent;
  2385.             }
  2386.             set
  2387.             {
  2388.                 this.highlightInfrequent = value;
  2389.             }
  2390.         }
  2391.         public xd53b20b7b4b2a08a MenuCommands
  2392.         {
  2393.             get
  2394.             {
  2395.                 return this.menuCommands;
  2396.             }
  2397.         }
  2398.         public bool RememberExpansion
  2399.         {
  2400.             get
  2401.             {
  2402.                 return this.rememberExpansion;
  2403.             }
  2404.             set
  2405.             {
  2406.                 this.rememberExpansion = value;
  2407.             }
  2408.         }
  2409.         public bool ShowInfrequent
  2410.         {
  2411.             get
  2412.             {
  2413.                 return this.showInfrequent;
  2414.             }
  2415.             set
  2416.             {
  2417.                 this.showInfrequent = value;
  2418.             }
  2419.         }
  2420.         internal enum xaa7785f730d8dd15
  2421.         {
  2422.             Check,
  2423.             Radio,
  2424.             SubMenu,
  2425.             CheckSelected,
  2426.             RadioSelected,
  2427.             SubMenuSelected,
  2428.             Expansion,
  2429.             ImageError
  2430.         }
  2431.         internal enum xd1ffc28f5c092301
  2432.         {
  2433.             BorderTop,
  2434.             BorderLeft,
  2435.             BorderBottom,
  2436.             BorderRight,
  2437.             ImageGapTop,
  2438.             ImageGapLeft,
  2439.             ImageGapBottom,
  2440.             ImageGapRight,
  2441.             TextGapLeft,
  2442.             TextGapRight,
  2443.             SubMenuGapLeft,
  2444.             SubMenuWidth,
  2445.             SubMenuGapRight,
  2446.             SeparatorHeight,
  2447.             SeparatorWidth,
  2448.             ShortcutGap,
  2449.             ShadowWidth,
  2450.             ShadowHeight,
  2451.             ExtraWidthGap,
  2452.             ExtraHeightGap,
  2453.             ExtraRightGap,
  2454.             ExtraReduce
  2455.         }
  2456.         internal enum xf398ffaf32ffe055
  2457.         {
  2458.             Left,
  2459.             Right,
  2460.             All
  2461.         }
  2462.     }
  2463. }