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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using Sunisoft.IrisSkin.InternalControls;
  4.     using System;
  5.     using System.Collections;
  6.     using System.Drawing;
  7.     using System.Drawing.Drawing2D;
  8.     using System.Drawing.Imaging;
  9.     using System.Windows.Forms;
  10.     internal abstract class xd24df615efe9450e : NativeWindow
  11.     {
  12.         protected Bitmap BottomBuffer;
  13.         protected Bitmap[] ButtonBuffer;
  14.         protected Bitmap CaptionBuffer;
  15.         protected Hashtable ChildTable = new Hashtable();
  16.         protected Hashtable ControlTable = new Hashtable();
  17.         protected int cxBorder = 4;
  18.         protected int cyBorder = 4;
  19.         protected SkinEngine Engine;
  20.         protected uint ExtStyle;
  21.         protected bool Initializing = true;
  22.         protected int IsNCMouseDown = -1;
  23.         protected int LastMousePosition = 2;
  24.         protected Rectangle[] NCRects;
  25.         protected Color OriBackColor = Color.FromKnownColor(KnownColor.Control);
  26.         protected uint OriStyle;
  27.         protected int RestoreClientHeight;
  28.         protected int RestoreClientWidth;
  29.         protected int RestoreHeight;
  30.         protected int RestoreWidth;
  31.         protected Form Target;
  32.         protected Bitmap TitleBuffer;
  33.         private bool x230e512478b11e00 = true;
  34.         private int x2b4c907bdfe9f160;
  35.         private int x4cf0eb77a23bef26;
  36.         private bool x507503a87814ae33;
  37.         private int x5a29066520654c5a;
  38.         private int x6b81454f45088f2e;
  39.         private string xa4b5d355cbf01a80;
  40.         private bool xa6ac12f4249c7b54;
  41.         private x902c4aee45bfd906 xcdc1a69e212e5aa9;
  42.         private bool xfd408d62a1acef9b = true;
  43.         public xd24df615efe9450e(IntPtr handle, SkinEngine engine)
  44.         {
  45.             this.Engine = engine;
  46.             this.Target = (Form) Control.FromHandle(handle);
  47.             base.AssignHandle(handle);
  48.             this.GetWindowRestoreSize();
  49.             this.x18f04d42fe6eab01();
  50.             this.SaveWindowStyle();
  51.             if (this.CanPaint)
  52.             {
  53.                 this.ResetWindowStyle();
  54.             }
  55.             this.SkinControls();
  56.             this.ApplySkin();
  57.             this.Engine.CurrentSkinChanged += new SkinChanged(this.OnCurrentSkinChanged);
  58.             this.Initializing = false;
  59.         }
  60.         protected virtual unsafe void AfterWndProc(ref Message m)
  61.         {
  62.             uint msg = (uint) m.Msg;
  63.             if (msg <= 0x86)
  64.             {
  65.                 int num;
  66.                 switch (msg)
  67.                 {
  68.                     case 0x21:
  69.                         if (!this.IsDisposed && (this.TitleHeight < SystemInformation.CaptionHeight))
  70.                         {
  71.                             this.RefreshWindow();
  72.                         }
  73.                         return;
  74.                     case 0x22:
  75.                         if (!this.IsDisposed && (this.TitleHeight < SystemInformation.CaptionHeight))
  76.                         {
  77.                             this.RefreshWindow();
  78.                         }
  79.                         return;
  80.                     case 130:
  81.                         if (this.Target != null)
  82.                         {
  83.                             this.Target.Width = this.RestoreWidth;
  84.                             this.Target.Height = this.RestoreHeight;
  85.                         }
  86.                         return;
  87.                     case 0x83:
  88.                         if (m.WParam.ToInt32() != 0)
  89.                         {
  90.                             x40255b11ef821fa3.NCCALCSIZE_PARAMS* lParam = (x40255b11ef821fa3.NCCALCSIZE_PARAMS*) m.LParam;
  91.                             x40255b11ef821fa3.WINDOWPOS* lppos = (x40255b11ef821fa3.WINDOWPOS*) lParam->lppos;
  92.                             lParam->rgrc0.Y = lppos->y + this.TitleHeight;
  93.                             if ((this.WindowState == FormWindowState.Maximized) && this.IsMdiChild)
  94.                             {
  95.                                 lParam->rgrc0.Width = lppos->x + lppos->cx;
  96.                                 lParam->rgrc0.X = lppos->x;
  97.                                 lParam->rgrc0.Height = lppos->y + lppos->cy;
  98.                                 lParam->rgrc1 = lParam->rgrc0;
  99.                             }
  100.                             else
  101.                             {
  102.                                 lParam->rgrc0.Width = (lppos->x + lppos->cx) - Math.Max(this.Engine.RightBorderWidth, this.cxBorder);
  103.                                 lParam->rgrc0.X = lppos->x + Math.Max(this.Engine.LeftBorderWidth, this.cxBorder);
  104.                                 lParam->rgrc0.Height = (lppos->y + lppos->cy) - Math.Max(this.Engine.BottomBorderHeight, this.cyBorder);
  105.                                 lParam->rgrc1 = lParam->rgrc0;
  106.                             }
  107.                             m.Result = new IntPtr(0x400L);
  108.                             this.x271f237e4704798d();
  109.                             return;
  110.                         }
  111.                         return;
  112.                     case 0x84:
  113.                     case 0x85:
  114.                         return;
  115.                     case 0x86:
  116.                         num = m.WParam.ToInt32();
  117.                         if (!this.IsMdiChild)
  118.                         {
  119.                             if (num != 0)
  120.                             {
  121.                                 this.IsActive = true;
  122.                             }
  123.                             else
  124.                             {
  125.                                 this.IsActive = false;
  126.                             }
  127.                             this.x3b8ca818f0c2637e();
  128.                             this.RefreshMainMenu();
  129.                             return;
  130.                         }
  131.                         this.x3b8ca818f0c2637e();
  132.                         return;
  133.                     case 5:
  134.                         x61467fe65a98f20c.SetWindowPos(base.Handle, IntPtr.Zero, 0, 0, 0, 0, 0x37);
  135.                         this.RegionWindow();
  136.                         this.IsNCMouseDown = -1;
  137.                         num = m.WParam.ToInt32();
  138.                         if (this.Target != null)
  139.                         {
  140.                             switch (((uint) num))
  141.                             {
  142.                                 case 0:
  143.                                     this.x2b4c907bdfe9f160 = this.Target.Width;
  144.                                     this.x4cf0eb77a23bef26 = this.Target.Height;
  145.                                     this.xa6ac12f4249c7b54 = true;
  146.                                     return;
  147.                                 case 1:
  148.                                     if (this.xa6ac12f4249c7b54)
  149.                                     {
  150.                                         this.Target.Width = this.x2b4c907bdfe9f160;
  151.                                         this.Target.Height = this.x4cf0eb77a23bef26;
  152.                                     }
  153.                                     return;
  154.                                 case 2:
  155.                                     if (this.xa6ac12f4249c7b54)
  156.                                     {
  157.                                         this.Target.Width = this.x2b4c907bdfe9f160;
  158.                                         this.Target.Height = this.x4cf0eb77a23bef26;
  159.                                     }
  160.                                     return;
  161.                             }
  162.                         }
  163.                         return;
  164.                     case 6:
  165.                         num = m.WParam.ToInt32();
  166.                         if (!this.IsMdiChild)
  167.                         {
  168.                             if (((num & 1L) == 1L) || ((num & 2L) == 2L))
  169.                             {
  170.                                 this.IsActive = true;
  171.                             }
  172.                             else
  173.                             {
  174.                                 this.IsActive = false;
  175.                             }
  176.                             this.x3b8ca818f0c2637e();
  177.                             this.RefreshMainMenu();
  178.                             if (!this.IsDisposed && (this.TitleHeight < SystemInformation.CaptionHeight))
  179.                             {
  180.                                 this.RefreshWindow();
  181.                             }
  182.                             return;
  183.                         }
  184.                         this.x3b8ca818f0c2637e();
  185.                         this.RefreshWindow();
  186.                         return;
  187.                     case 12:
  188.                         this.x271f237e4704798d();
  189.                         this.x3b8ca818f0c2637e();
  190.                         return;
  191.                 }
  192.             }
  193.             else
  194.             {
  195.                 if (msg <= 310)
  196.                 {
  197.                     if (msg == 0xa1)
  198.                     {
  199.                         if (m.WParam.ToInt32() == 3)
  200.                         {
  201.                             this.DoSysMenu();
  202.                         }
  203.                         return;
  204.                     }
  205.                     if (msg != 310)
  206.                     {
  207.                         return;
  208.                     }
  209.                 }
  210.                 else
  211.                 {
  212.                     switch (msg)
  213.                     {
  214.                         case 0x214:
  215.                         {
  216.                             int num2 = m.LParam.ToInt32();
  217.                             int formMinWidth = this.Engine.FormMinWidth;
  218.                             if (!this.HelpButton)
  219.                             {
  220.                                 formMinWidth -= 6;
  221.                             }
  222.                             if (!this.MinimizeBox)
  223.                             {
  224.                                 formMinWidth -= 6;
  225.                             }
  226.                             if (!this.MaximizeBox)
  227.                             {
  228.                                 formMinWidth -= 6;
  229.                             }
  230.                             int num4 = (this.Engine.TitleHeight + Math.Max(this.Engine.BottomBorderHeight, this.cyBorder)) + this.MenuHeight;
  231.                             xae4dd1cafd2eb77c.RECT* rectPtr = (xae4dd1cafd2eb77c.RECT*) num2;
  232.                             if ((rectPtr->right - rectPtr->left) < formMinWidth)
  233.                             {
  234.                                 rectPtr->right = rectPtr->left + formMinWidth;
  235.                             }
  236.                             if ((rectPtr->bottom - rectPtr->top) < num4)
  237.                             {
  238.                                 rectPtr->bottom = rectPtr->top + num4;
  239.                             }
  240.                             return;
  241.                         }
  242.                         case 0x222:
  243.                             if (!this.IsDisposed && (this.TitleHeight < SystemInformation.CaptionHeight))
  244.                             {
  245.                                 this.RefreshWindow();
  246.                             }
  247.                             return;
  248.                     }
  249.                     return;
  250.                 }
  251.                 m.Result = this.Engine.BackColorBrush;
  252.             }
  253.         }
  254.         protected virtual void ApplySkin()
  255.         {
  256.             if (this.CanPaint)
  257.             {
  258.                 x61467fe65a98f20c.SetWindowPos(base.Handle, IntPtr.Zero, 0, 0, 0, 0, 0x37);
  259.             }
  260.         }
  261.         protected virtual bool BeforeWndProc(ref Message m)
  262.         {
  263.             int num;
  264.             switch (((uint) m.Msg))
  265.             {
  266.                 case 0x84:
  267.                     m.Result = new IntPtr((long) this.x13d7e7b52a69e5dc());
  268.                     return false;
  269.                 case 0x85:
  270.                     this.x3b8ca818f0c2637e();
  271.                     return false;
  272.                 case 0x86:
  273.                     if (m.WParam.ToInt32() != 0)
  274.                     {
  275.                         goto Label_03D3;
  276.                     }
  277.                     m.Result = new IntPtr(1);
  278.                     return false;
  279.                 case 70:
  280.                     if (this.RightToLeftLayout)
  281.                     {
  282.                         this.ExtStyle = x61467fe65a98f20c.GetWindowLong(base.Handle, -20);
  283.                         if ((this.ExtStyle & 0x400000) == 0x400000)
  284.                         {
  285.                             x61467fe65a98f20c.SetWindowLong(base.Handle, -20, (uint) (this.ExtStyle - 0x400000));
  286.                         }
  287.                     }
  288.                     goto Label_03D3;
  289.                 case 0x20:
  290.                     this.ResetWindowStyle();
  291.                     goto Label_03D3;
  292.                 case 0x313:
  293.                 {
  294.                     Point lpPoint = new Point(0, 0);
  295.                     x61467fe65a98f20c.GetCursorPos(ref lpPoint);
  296.                     this.xd308f013f560f5be(lpPoint);
  297.                     return false;
  298.                 }
  299.                 case 0x20d1:
  300.                     m.Result = new IntPtr(0x20d1);
  301.                     return false;
  302.                 case 160:
  303.                     num = m.WParam.ToInt32();
  304.                     if (((num != 9) && (num != 8)) && ((num != 20) && (num != 0x15)))
  305.                     {
  306.                         this.IsNCMouseDown = -1;
  307.                     }
  308.                     if (((this.LastMousePosition == 9) || (this.LastMousePosition == 8)) || ((this.LastMousePosition == 20) || (this.LastMousePosition == 0x15)))
  309.                     {
  310.                         switch (num)
  311.                         {
  312.                             case 9:
  313.                             case 8:
  314.                             case 20:
  315.                             case 0x15:
  316.                                 if (this.LastMousePosition != num)
  317.                                 {
  318.                                     this.x6616b01fd7cbc65d(0);
  319.                                     this.LastMousePosition = 0;
  320.                                     this.x6616b01fd7cbc65d(num);
  321.                                 }
  322.                                 goto Label_029E;
  323.                         }
  324.                         this.x6616b01fd7cbc65d(num);
  325.                     }
  326.                     else
  327.                     {
  328.                         switch (num)
  329.                         {
  330.                             case 9:
  331.                             case 8:
  332.                             case 20:
  333.                             case 0x15:
  334.                                 this.x6616b01fd7cbc65d(num);
  335.                                 break;
  336.                         }
  337.                     }
  338.                     goto Label_029E;
  339.                 case 0xa1:
  340.                     num = m.WParam.ToInt32();
  341.                     this.IsNCMouseDown = num;
  342.                     if (((this.IsNCMouseDown == 0x15) || (this.IsNCMouseDown == 8)) || ((this.IsNCMouseDown == 9) || (this.IsNCMouseDown == 20)))
  343.                     {
  344.                         this.x6616b01fd7cbc65d(num);
  345.                         this.LastMousePosition = num;
  346.                         return false;
  347.                     }
  348.                     if (((this.Text != "") || this.ControlBox) || (num != 2))
  349.                     {
  350.                         if (num == 0)
  351.                         {
  352.                             return false;
  353.                         }
  354.                         if ((num != 2) || (this.WindowState != FormWindowState.Maximized))
  355.                         {
  356.                             goto Label_03D3;
  357.                         }
  358.                         m.WParam = new IntPtr(0);
  359.                         x61467fe65a98f20c.SetWindowPos(base.Handle, new IntPtr(0), 0, 0, 0, 0, 3);
  360.                     }
  361.                     return false;
  362.                 case 0xa2:
  363.                 {
  364.                     uint num3 = this.x13d7e7b52a69e5dc();
  365.                     if (num3 == this.IsNCMouseDown)
  366.                     {
  367.                         switch (num3)
  368.                         {
  369.                             case 8:
  370.                                 this.DoMin();
  371.                                 goto Label_0179;
  372.                             case 9:
  373.                                 this.DoMax();
  374.                                 goto Label_0179;
  375.                             case 20:
  376.                                 this.DoClose();
  377.                                 goto Label_0179;
  378.                             case 0x15:
  379.                                 this.DoHelp();
  380.                                 goto Label_0179;
  381.                         }
  382.                     }
  383.                     goto Label_0179;
  384.                 }
  385.                 case 0xa3:
  386.                     if (!(this.Text == "") || this.ControlBox)
  387.                     {
  388.                         num = m.WParam.ToInt32();
  389.                         switch (num)
  390.                         {
  391.                             case 2:
  392.                                 if (this.MaximizeBox)
  393.                                 {
  394.                                     this.DoMax();
  395.                                 }
  396.                                 this.IsNCMouseDown = -1;
  397.                                 return false;
  398.                             case 3:
  399.                                 this.DoClose();
  400.                                 this.IsNCMouseDown = -1;
  401.                                 this.xd1faceba1dee38cf.Dismiss();
  402.                                 return false;
  403.                         }
  404.                         goto Label_03D3;
  405.                     }
  406.                     return false;
  407.                 case 0xa4:
  408.                     if (this.ControlBox && (m.WParam.ToInt32() == 2))
  409.                     {
  410.                         int num2 = m.LParam.ToInt32();
  411.                         Point p = new Point(num2 & 0xffff, (int) ((num2 & 0xffff0000L) >> 0x10));
  412.                         this.DoSysMenu(p);
  413.                     }
  414.                     return false;
  415.                 case 0xae:
  416.                     return false;
  417.             }
  418.             goto Label_03D3;
  419.         Label_0179:
  420.             this.IsNCMouseDown = -1;
  421.             return false;
  422.         Label_029E:
  423.             this.LastMousePosition = num;
  424.             return false;
  425.         Label_03D3:
  426.             return true;
  427.         }
  428.         protected virtual void DoClose()
  429.         {
  430.             x61467fe65a98f20c.PostMessage(base.Handle, 0x112, (uint) 0xf060, (uint) 0);
  431.         }
  432.         protected virtual void DoHelp()
  433.         {
  434.             x61467fe65a98f20c.PostMessage(base.Handle, 0x112, (uint) 0xf180, (uint) 0);
  435.         }
  436.         protected virtual void DoMax()
  437.         {
  438.             if (this.WindowState == FormWindowState.Maximized)
  439.             {
  440.                 this.WindowState = FormWindowState.Normal;
  441.             }
  442.             else
  443.             {
  444.                 this.WindowState = FormWindowState.Maximized;
  445.             }
  446.         }
  447.         protected virtual void DoMin()
  448.         {
  449.             if (this.IsMdiChild && (this.WindowState == FormWindowState.Minimized))
  450.             {
  451.                 this.WindowState = FormWindowState.Normal;
  452.             }
  453.             else
  454.             {
  455.                 this.WindowState = FormWindowState.Minimized;
  456.             }
  457.         }
  458.         protected virtual void DoSysMenu()
  459.         {
  460.             this.xd1faceba1dee38cf.MenuCommands[0].Enabled = this.MinimizeBox;
  461.             this.xd1faceba1dee38cf.MenuCommands[1].Enabled = this.MaximizeBox;
  462.             if (this.RightToLeftLayout)
  463.             {
  464.                 this.xd1faceba1dee38cf.TrackPopup(this.PointToScreen(new Point(this.NCRects[3].X, this.NCRects[3].Bottom - this.TitleHeight)));
  465.             }
  466.             else
  467.             {
  468.                 this.xd1faceba1dee38cf.TrackPopup(this.PointToScreen(new Point(0, 0)));
  469.             }
  470.         }
  471.         protected virtual void DoSysMenu(Point p)
  472.         {
  473.             this.xd1faceba1dee38cf.MenuCommands[0].Enabled = this.MinimizeBox;
  474.             this.xd1faceba1dee38cf.MenuCommands[1].Enabled = this.MaximizeBox;
  475.             this.xd1faceba1dee38cf.TrackPopup(p);
  476.         }
  477.         protected virtual void GetWindowRestoreSize()
  478.         {
  479.             x40255b11ef821fa3.WINDOWPLACEMENT lpwndpl = new x40255b11ef821fa3.WINDOWPLACEMENT();
  480.             x61467fe65a98f20c.GetWindowPlacement(base.Handle, ref lpwndpl);
  481.             this.RestoreWidth = lpwndpl.rcNormalPosition.Width - lpwndpl.rcNormalPosition.X;
  482.             this.RestoreHeight = lpwndpl.rcNormalPosition.Height - lpwndpl.rcNormalPosition.Y;
  483.             if (this.Target != null)
  484.             {
  485.                 if (((this.Target.WindowState == FormWindowState.Normal) && (this.Target.ClientRectangle.Width != 0)) && (this.Target.ClientRectangle.Height != 0))
  486.                 {
  487.                     this.RestoreClientWidth = this.Target.ClientRectangle.Width;
  488.                     this.RestoreClientHeight = this.Target.ClientRectangle.Height;
  489.                 }
  490.                 else
  491.                 {
  492.                     this.RestoreClientHeight = (this.RestoreHeight - SystemInformation.CaptionHeight) - this.cyBorder;
  493.                     if (this.Target.Menu != null)
  494.                     {
  495.                         this.RestoreClientHeight -= SystemInformation.MenuHeight;
  496.                     }
  497.                     this.RestoreClientWidth = this.RestoreWidth - (2 * this.cxBorder);
  498.                 }
  499.             }
  500.             else
  501.             {
  502.                 Rectangle lpRect = new Rectangle();
  503.                 x61467fe65a98f20c.GetClientRect(base.Handle, ref lpRect);
  504.                 this.RestoreClientWidth = lpRect.Width;
  505.                 this.RestoreClientHeight = lpRect.Height;
  506.             }
  507.         }
  508.         protected virtual void OnCurrentSkinChanged(object sender, SkinChangedEventArgs e)
  509.         {
  510.             this.ResetWindowStyle();
  511.             if (!this.CanPaint)
  512.             {
  513.                 this.Region = null;
  514.                 if (this.RightToLeftLayout)
  515.                 {
  516.                     if ((this.ExtStyle & 0x400000) == 0)
  517.                     {
  518.                         this.ExtStyle += 0x400000;
  519.                     }
  520.                     x61467fe65a98f20c.SetWindowLong(base.Handle, -20, this.ExtStyle);
  521.                 }
  522.             }
  523.             else if (this.RightToLeftLayout && ((this.ExtStyle & 0x400000) == 0x400000))
  524.             {
  525.                 x61467fe65a98f20c.SetWindowLong(base.Handle, -20, (uint) (this.ExtStyle - 0x400000));
  526.             }
  527.             x61467fe65a98f20c.SetWindowPos(base.Handle, IntPtr.Zero, 0, 0, 0, 0, 0x37);
  528.         }
  529.         protected virtual void PaintBorder(Graphics g)
  530.         {
  531.             Rectangle rectangle;
  532.             int width = this.Width;
  533.             int height = this.Height;
  534.             int menuHeight = 0;
  535.             if (this.MenuHeight != 0)
  536.             {
  537.                 menuHeight = this.MenuHeight;
  538.             }
  539.             Bitmap image = this.Engine.Res.Bitmaps.SKIN2_FORMLEFTBORDER;
  540.             if (image.Width < this.cxBorder)
  541.             {
  542.                 rectangle = Rectangle.FromLTRB(0, this.TitleHeight, this.cxBorder, height - this.Engine.BottomBorderHeight);
  543.                 g.FillRectangle(this.Engine.Res.Brushes.SKIN2_FORMCOLOR, rectangle);
  544.                 if (menuHeight > 0)
  545.                 {
  546.                     rectangle = Rectangle.FromLTRB(this.cxBorder - image.Width, this.TitleHeight, this.cxBorder, this.TitleHeight + menuHeight);
  547.                 }
  548.             }
  549.             rectangle = Rectangle.FromLTRB(0, this.TitleHeight, this.Engine.LeftBorderWidth, height - this.Engine.BottomBorderHeight);
  550.             Rectangle rectangle2 = new Rectangle(0, 0, image.Width, image.Height);
  551.             g.DrawImage(image, rectangle, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY, null);
  552.             image = this.Engine.Res.Bitmaps.SKIN2_FORMRIGHTBORDER;
  553.             if (image.Width < this.cxBorder)
  554.             {
  555.                 rectangle = Rectangle.FromLTRB(width - this.cxBorder, this.TitleHeight, width, height - this.Engine.BottomBorderHeight);
  556.                 g.FillRectangle(this.Engine.Res.Brushes.SKIN2_FORMCOLOR, rectangle);
  557.             }
  558.             rectangle = Rectangle.FromLTRB(width - this.Engine.RightBorderWidth, this.TitleHeight, width, height - this.Engine.BottomBorderHeight);
  559.             rectangle2 = new Rectangle(0, 0, image.Width, image.Height);
  560.             g.DrawImage(image, rectangle, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY, null);
  561.         }
  562.         protected abstract Point PointToScreen(Point point);
  563.         protected virtual void RefreshMainMenu()
  564.         {
  565.         }
  566.         protected virtual void RefreshWindow()
  567.         {
  568.         }
  569.         protected virtual unsafe void RegionWindow()
  570.         {
  571.             int num;
  572.             int num2;
  573.             int num3;
  574.             int num4;
  575.             int num8;
  576.             int num9;
  577.             byte num10;
  578.             if (this.IsMdiChild && (this.WindowState != FormWindowState.Normal))
  579.             {
  580.                 if ((this.Width > 0) && (this.Height > 0))
  581.                 {
  582.                     this.Region = new System.Drawing.Region(new Rectangle(0, 0, this.Width, this.Height));
  583.                 }
  584.                 return;
  585.             }
  586.             if (((this.TitleBuffer == null) || (this.BottomBuffer == null)) || (this.TitleBuffer.Width != this.Width))
  587.             {
  588.                 this.x58714ffe12c688d9();
  589.                 this.x3c424b74aaf6d003();
  590.             }
  591.             if (!this.Engine.Res.Bools.SKIN2_TITLEBARNEEDREGION && !this.Engine.Res.Bools.SKIN2_BOTTOMBORDERNEEDREGION)
  592.             {
  593.                 this.Region = new System.Drawing.Region(new Rectangle(0, 0, this.Width, this.Height));
  594.                 return;
  595.             }
  596.             Bitmap titleBuffer = this.TitleBuffer;
  597.             int num7 = 4;
  598.             int height = titleBuffer.Height;
  599.             int width = titleBuffer.Width;
  600.             if (width < this.Width)
  601.             {
  602.                 this.x58714ffe12c688d9();
  603.                 this.x3c424b74aaf6d003();
  604.                 this.x9d937faa8065bfbb();
  605.                 titleBuffer = this.TitleBuffer;
  606.                 height = titleBuffer.Height;
  607.                 width = titleBuffer.Width;
  608.             }
  609.             BitmapData bitmapdata = null;
  610.             bool flag = true;
  611.             GraphicsPath path = new GraphicsPath();
  612.             if (this.Engine.Res.Bools.SKIN2_TITLEBARNEEDREGION)
  613.             {
  614.                 num9 = this.Engine.Res.Integers.SKIN2_TITLEBARREGIONMINY;
  615.                 num8 = this.Engine.Res.Integers.SKIN2_TITLEBARREGIONMAXY;
  616.                 path.AddRectangle(new Rectangle(0, 0, width, num9));
  617.                 path.AddRectangle(Rectangle.FromLTRB(0, num8 + 1, width, height));
  618.                 try
  619.                 {
  620.                     bitmapdata = titleBuffer.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
  621.                     byte* numPtr = (byte*) bitmapdata.Scan0;
  622.                     numPtr += 3 + ((num7 * num9) * width);
  623.                     for (num = num9; num <= num8; num++)
  624.                     {
  625.                         num3 = 0;
  626.                         num4 = 0;
  627.                         flag = true;
  628.                         num2 = 0;
  629.                         while (num2 < width)
  630.                         {
  631.                             num10 = numPtr[0];
  632.                             if ((num10 == 0) || (num2 == (width - 1)))
  633.                             {
  634.                                 if ((num2 == (width - 1)) && (num10 != 0))
  635.                                 {
  636.                                     path.AddRectangle(Rectangle.FromLTRB(num3, num, num2 + 1, num + 1));
  637.                                 }
  638.                                 else if (!flag)
  639.                                 {
  640.                                     path.AddRectangle(Rectangle.FromLTRB(num3, num, num4 + 1, num + 1));
  641.                                 }
  642.                                 flag = true;
  643.                             }
  644.                             else
  645.                             {
  646.                                 if (flag)
  647.                                 {
  648.                                     num3 = num2;
  649.                                     num4 = num2;
  650.                                 }
  651.                                 else
  652.                                 {
  653.                                     num4++;
  654.                                 }
  655.                                 flag = false;
  656.                             }
  657.                             numPtr += num7;
  658.                             num2++;
  659.                         }
  660.                     }
  661.                     goto Label_027B;
  662.                 }
  663.                 catch
  664.                 {
  665.                     goto Label_027B;
  666.                 }
  667.                 finally
  668.                 {
  669.                     if (bitmapdata != null)
  670.                     {
  671.                         titleBuffer.UnlockBits(bitmapdata);
  672.                     }
  673.                 }
  674.             }
  675.             path.AddRectangle(new Rectangle(0, 0, width, height));
  676.         Label_027B:
  677.             path.AddRectangle(Rectangle.FromLTRB(0, height, this.Width, this.Height - this.BottomBuffer.Height));
  678.             bitmapdata = null;
  679.             titleBuffer = this.BottomBuffer;
  680.             height = titleBuffer.Height;
  681.             width = titleBuffer.Width;
  682.             int y = this.Height - height;
  683.             if (this.Engine.Res.Bools.SKIN2_BOTTOMBORDERNEEDREGION)
  684.             {
  685.                 num9 = this.Engine.Res.Integers.SKIN2_BOTTOMREGIONMINY;
  686.                 num8 = this.Engine.Res.Integers.SKIN2_BOTTOMREGIONMAXY;
  687.                 path.AddRectangle(new Rectangle(0, y, width, num9));
  688.                 if (((num8 + y) + 1) < this.Height)
  689.                 {
  690.                     path.AddRectangle(Rectangle.FromLTRB(0, (num8 + y) + 1, width, this.Height));
  691.                 }
  692.                 try
  693.                 {
  694.                     bitmapdata = titleBuffer.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
  695.                     byte* numPtr2 = (byte*) bitmapdata.Scan0;
  696.                     numPtr2 += 3 + ((num7 * num9) * width);
  697.                     for (num = num9; num <= num8; num++)
  698.                     {
  699.                         num3 = 0;
  700.                         num4 = 0;
  701.                         flag = true;
  702.                         for (num2 = 0; num2 < width; num2++)
  703.                         {
  704.                             num10 = numPtr2[0];
  705.                             if ((num10 == 0) || (num2 == (width - 1)))
  706.                             {
  707.                                 if ((num2 == (width - 1)) && (num10 != 0))
  708.                                 {
  709.                                     path.AddRectangle(Rectangle.FromLTRB(num3, num + y, num2 + 1, (num + 1) + y));
  710.                                 }
  711.                                 else if (!flag)
  712.                                 {
  713.                                     path.AddRectangle(Rectangle.FromLTRB(num3, num + y, num4 + 1, (num + 1) + y));
  714.                                 }
  715.                                 flag = true;
  716.                             }
  717.                             else
  718.                             {
  719.                                 if (flag)
  720.                                 {
  721.                                     num3 = num2;
  722.                                     num4 = num2;
  723.                                 }
  724.                                 else
  725.                                 {
  726.                                     num4++;
  727.                                 }
  728.                                 flag = false;
  729.                             }
  730.                             numPtr2 += num7;
  731.                         }
  732.                     }
  733.                     goto Label_044F;
  734.                 }
  735.                 catch
  736.                 {
  737.                     goto Label_044F;
  738.                 }
  739.                 finally
  740.                 {
  741.                     if (bitmapdata != null)
  742.                     {
  743.                         titleBuffer.UnlockBits(bitmapdata);
  744.                     }
  745.                 }
  746.             }
  747.             path.AddRectangle(new Rectangle(0, y, width, height));
  748.         Label_044F:
  749.             this.Region = new System.Drawing.Region(path);
  750.         }
  751.         protected virtual void ResetWindowStyle()
  752.         {
  753.             uint windowLong = x61467fe65a98f20c.GetWindowLong(base.Handle, -16);
  754.             if (this.CanPaint)
  755.             {
  756.                 if ((windowLong & 0x80000) == 0x80000)
  757.                 {
  758.                     this.x507503a87814ae33 = true;
  759.                     windowLong -= 0x80000;
  760.                 }
  761.             }
  762.             else if (this.x507503a87814ae33)
  763.             {
  764.                 windowLong |= 0x80000;
  765.                 this.x507503a87814ae33 = false;
  766.             }
  767.             if (!this.IsDisposed && (this.BorderStyle != FormBorderStyle.None))
  768.             {
  769.                 x61467fe65a98f20c.SetWindowLong(base.Handle, -16, windowLong);
  770.             }
  771.         }
  772.         protected virtual void SaveWindowStyle()
  773.         {
  774.             this.OriStyle = x61467fe65a98f20c.GetWindowLong(base.Handle, -16);
  775.             this.ExtStyle = x61467fe65a98f20c.GetWindowLong(base.Handle, -20);
  776.             if ((this.RightToLeftLayout && this.CanPaint) && ((this.ExtStyle & 0x400000) == 0x400000))
  777.             {
  778.                 x61467fe65a98f20c.SetWindowLong(base.Handle, -20, (uint) (this.ExtStyle - 0x400000));
  779.             }
  780.         }
  781.         protected abstract void SkinControls();
  782.         protected override void WndProc(ref Message m)
  783.         {
  784.             if (this.CanPaint)
  785.             {
  786.                 if (this.BeforeWndProc(ref m))
  787.                 {
  788.                     base.WndProc(ref m);
  789.                 }
  790.                 this.AfterWndProc(ref m);
  791.             }
  792.             else
  793.             {
  794.                 base.WndProc(ref m);
  795.             }
  796.         }
  797.         private int x0c7b47d7852a0e99()
  798.         {
  799.             int num = this.Engine.Res.Integers.SKIN2_TITLEBARBUTTONPOSY;
  800.             if ((this.WindowState == FormWindowState.Minimized) && this.IsMdiChild)
  801.             {
  802.                 Bitmap bitmap = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[1];
  803.                 num = Math.Max((0x1a - bitmap.Height) / 2, 0);
  804.                 if ((num + bitmap.Height) < 0x16)
  805.                 {
  806.                     num += 2;
  807.                 }
  808.             }
  809.             if (num < 4)
  810.             {
  811.                 num = 4;
  812.             }
  813.             return num;
  814.         }
  815.         private uint x13d7e7b52a69e5dc()
  816.         {
  817.             Point lpPoint = new Point(0, 0);
  818.             if (x61467fe65a98f20c.GetCursorPos(ref lpPoint))
  819.             {
  820.                 if (!x61467fe65a98f20c.ScreenToClient(base.Handle, ref lpPoint))
  821.                 {
  822.                     return 0;
  823.                 }
  824.                 if (this.NCRects == null)
  825.                 {
  826.                     return 0;
  827.                 }
  828.                 lpPoint.X += Math.Max(this.Engine.LeftBorderWidth, 4);
  829.                 lpPoint.Y += this.TitleHeight;
  830.                 if (this.IsMdiChild && (this.WindowState == FormWindowState.Maximized))
  831.                 {
  832.                     return 1;
  833.                 }
  834.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[3]))
  835.                 {
  836.                     return 3;
  837.                 }
  838.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[20]))
  839.                 {
  840.                     return 20;
  841.                 }
  842.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[9]))
  843.                 {
  844.                     return 9;
  845.                 }
  846.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[8]))
  847.                 {
  848.                     return 8;
  849.                 }
  850.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[8]))
  851.                 {
  852.                     return 8;
  853.                 }
  854.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[0x15]))
  855.                 {
  856.                     return 0x15;
  857.                 }
  858.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[0x10]))
  859.                 {
  860.                     return 0x10;
  861.                 }
  862.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[0x11]))
  863.                 {
  864.                     return 0x11;
  865.                 }
  866.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[13]))
  867.                 {
  868.                     return 13;
  869.                 }
  870.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[14]))
  871.                 {
  872.                     return 14;
  873.                 }
  874.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[10]))
  875.                 {
  876.                     return 10;
  877.                 }
  878.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[11]))
  879.                 {
  880.                     return 11;
  881.                 }
  882.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[12]))
  883.                 {
  884.                     return 12;
  885.                 }
  886.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[15]))
  887.                 {
  888.                     return 15;
  889.                 }
  890.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[2]))
  891.                 {
  892.                     return 2;
  893.                 }
  894.                 if (x448fd9ab43628c71.InRect(lpPoint, this.NCRects[1]))
  895.                 {
  896.                     return 1;
  897.                 }
  898.             }
  899.             return 0;
  900.         }
  901.         protected void x18f04d42fe6eab01()
  902.         {
  903.             x40255b11ef821fa3.WINDOWINFO pwi = new x40255b11ef821fa3.WINDOWINFO();
  904.             x61467fe65a98f20c.GetWindowInfo(base.Handle, ref pwi);
  905.             this.cxBorder = (int) pwi.cxWindowBorders;
  906.             this.cyBorder = (int) pwi.cyWindowBorders;
  907.         }
  908.         private void x271f237e4704798d()
  909.         {
  910.             int formCaptionPosX;
  911.             this.NCRects = new Rectangle[0x17];
  912.             int width = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[1].Width;
  913.             int height = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[1].Height;
  914.             int y = this.x0c7b47d7852a0e99();
  915.             int num4 = this.Engine.Res.Integers.SKIN2_TITLEBARICONPOSX;
  916.             if (this.ControlBox)
  917.             {
  918.                 formCaptionPosX = num4 + 4;
  919.                 this.NCRects[3] = new Rectangle(formCaptionPosX, y, 0x10, 0x10);
  920.                 num4 = formCaptionPosX + 0x12;
  921.                 int rightBorderWidth = this.Engine.Res.Integers.SKIN2_TITLEBARBUTTONPOSX;
  922.                 if (rightBorderWidth < this.Engine.RightBorderWidth)
  923.                 {
  924.                     rightBorderWidth = this.Engine.RightBorderWidth;
  925.                 }
  926.                 formCaptionPosX = (this.Width - rightBorderWidth) - width;
  927.                 this.NCRects[20] = new Rectangle(formCaptionPosX, y, width, height);
  928.                 formCaptionPosX -= width + 2;
  929.                 if (this.MaximizeBox)
  930.                 {
  931.                     this.NCRects[9] = new Rectangle(formCaptionPosX, y, width, height);
  932.                     formCaptionPosX -= width + 2;
  933.                 }
  934.                 if (this.MinimizeBox)
  935.                 {
  936.                     this.NCRects[8] = new Rectangle(formCaptionPosX, y, width, height);
  937.                     formCaptionPosX -= width + 2;
  938.                 }
  939.                 if (this.HelpButton)
  940.                 {
  941.                     this.NCRects[0x15] = new Rectangle(formCaptionPosX, y, width, height);
  942.                     formCaptionPosX -= width + 2;
  943.                 }
  944.             }
  945.             width = this.Width;
  946.             height = this.Height;
  947.             int titleHeight = this.TitleHeight;
  948.             this.NCRects[2] = new Rectangle(0, 0, width, titleHeight);
  949.             this.NCRects[1] = new Rectangle(0, 0, width, height);
  950.             if (this.CanSize)
  951.             {
  952.                 this.NCRects[10] = new Rectangle(0, titleHeight, 4, height - titleHeight);
  953.                 this.NCRects[11] = new Rectangle(width - 4, titleHeight, 4, height - titleHeight);
  954.                 this.NCRects[12] = new Rectangle(15, 0, width - 30, 4);
  955.                 this.NCRects[15] = new Rectangle(15, height - 4, width - 30, 4);
  956.                 this.NCRects[13] = new Rectangle(0, 0, 15, titleHeight);
  957.                 this.NCRects[14] = new Rectangle(width - 15, 0, 15, titleHeight);
  958.                 this.NCRects[0x10] = new Rectangle(0, height - 4, 15, 4);
  959.                 this.NCRects[0x11] = new Rectangle(width - 15, height - 15, 15, 15);
  960.             }
  961.             if (this.RightToLeftLayout)
  962.             {
  963.                 this.NCRects[20].X = (this.Width - this.NCRects[20].X) - 0x10;
  964.                 this.NCRects[9].X = (this.Width - this.NCRects[9].X) - 0x10;
  965.                 this.NCRects[8].X = (this.Width - this.NCRects[8].X) - 0x10;
  966.                 this.NCRects[3].X = (this.Width - this.NCRects[3].X) - 0x10;
  967.                 this.NCRects[0x15].X = (this.Width - this.NCRects[0x15].X) - 0x10;
  968.             }
  969.             using (Graphics graphics = Graphics.FromImage(new Bitmap(10, 10)))
  970.             {
  971.                 int num2;
  972.                 Font titleFont;
  973.                 if (this.RightToLeftLayout)
  974.                 {
  975.                     if (this.Engine.FormCaptionPosX == -1)
  976.                     {
  977.                         if (this.ControlBox && (this.Icon != null))
  978.                         {
  979.                             num2 = this.NCRects[3].Left - 2;
  980.                         }
  981.                         else
  982.                         {
  983.                             num2 = (width - Math.Max(this.Engine.RightBorderWidth, 4)) - 2;
  984.                         }
  985.                     }
  986.                     else
  987.                     {
  988.                         num2 = width - this.Engine.FormCaptionPosX;
  989.                     }
  990.                     if (this.ControlBox)
  991.                     {
  992.                         formCaptionPosX = this.NCRects[20].Right + 2;
  993.                         if (this.MaximizeBox)
  994.                         {
  995.                             formCaptionPosX = this.NCRects[9].Right + 2;
  996.                         }
  997.                         if (this.MinimizeBox)
  998.                         {
  999.                             formCaptionPosX = this.NCRects[8].Right + 2;
  1000.                         }
  1001.                         if (this.HelpButton)
  1002.                         {
  1003.                             formCaptionPosX = this.NCRects[0x15].Right + 2;
  1004.                         }
  1005.                     }
  1006.                     else
  1007.                     {
  1008.                         formCaptionPosX = Math.Max(this.Engine.LeftBorderWidth, 4) + 0x10;
  1009.                     }
  1010.                 }
  1011.                 else
  1012.                 {
  1013.                     if (this.Engine.FormCaptionPosX == -1)
  1014.                     {
  1015.                         if (this.ControlBox && (this.Icon != null))
  1016.                         {
  1017.                             formCaptionPosX = this.NCRects[3].Right + 2;
  1018.                         }
  1019.                         else
  1020.                         {
  1021.                             formCaptionPosX = Math.Max(this.Engine.LeftBorderWidth, 4) + 0x10;
  1022.                         }
  1023.                     }
  1024.                     else
  1025.                     {
  1026.                         formCaptionPosX = this.Engine.FormCaptionPosX;
  1027.                     }
  1028.                     if (this.ControlBox)
  1029.                     {
  1030.                         num2 = this.NCRects[20].Left - 2;
  1031.                         if (this.MaximizeBox)
  1032.                         {
  1033.                             num2 = this.NCRects[9].Left - 2;
  1034.                         }
  1035.                         if (this.MinimizeBox)
  1036.                         {
  1037.                             num2 = this.NCRects[8].Left - 2;
  1038.                         }
  1039.                         if (this.HelpButton)
  1040.                         {
  1041.                             num2 = this.NCRects[0x15].Left - 2;
  1042.                         }
  1043.                     }
  1044.                     else
  1045.                     {
  1046.                         num2 = (width - this.Engine.RightBorderWidth) - 2;
  1047.                     }
  1048.                 }
  1049.                 if (this.Engine.Res.Bools.SKIN2_TITLEFIVESECT)
  1050.                 {
  1051.                     num2 -= this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3.Width;
  1052.                 }
  1053.                 if (this.Engine.TitleFont == null)
  1054.                 {
  1055.                     titleFont = x448fd9ab43628c71.TitleFont;
  1056.                 }
  1057.                 else
  1058.                 {
  1059.                     titleFont = this.Engine.TitleFont;
  1060.                 }
  1061.                 this.xa4b5d355cbf01a80 = x448fd9ab43628c71.FormatStringWithWidth(graphics, this.Text, titleFont, num2 - formCaptionPosX);
  1062.                 if ((this.RightToLeft & System.Windows.Forms.RightToLeft.Yes) == System.Windows.Forms.RightToLeft.Yes)
  1063.                 {
  1064.                     this.x5a29066520654c5a = num2;
  1065.                 }
  1066.                 else
  1067.                 {
  1068.                     this.x5a29066520654c5a = formCaptionPosX;
  1069.                 }
  1070.                 this.x6b81454f45088f2e = graphics.MeasureString(this.xa4b5d355cbf01a80, titleFont).ToSize().Width + 10;
  1071.             }
  1072.         }
  1073.         protected void x3b8ca818f0c2637e()
  1074.         {
  1075.             if ((this.NCRects != null) && this.CanPaint)
  1076.             {
  1077.                 try
  1078.                 {
  1079.                     IntPtr windowDC = x61467fe65a98f20c.GetWindowDC(base.Handle);
  1080.                     if (windowDC != IntPtr.Zero)
  1081.                     {
  1082.                         using (Graphics graphics = Graphics.FromHdc(windowDC))
  1083.                         {
  1084.                             this.x58714ffe12c688d9();
  1085.                             this.x3c424b74aaf6d003();
  1086.                             this.x9d937faa8065bfbb();
  1087.                             if (this.CaptionBuffer != null)
  1088.                             {
  1089.                                 graphics.DrawImageUnscaled(this.CaptionBuffer, 0, 0);
  1090.                             }
  1091.                             if (this.IsMdiChild && (this.WindowState == FormWindowState.Maximized))
  1092.                             {
  1093.                                 Brush brush = this.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  1094.                                 graphics.FillRectangle(brush, 0, 0, this.Width, this.TitleHeight);
  1095.                             }
  1096.                             else
  1097.                             {
  1098.                                 this.xfecf8a78f99f2530(graphics);
  1099.                                 if (!this.IsMdiChild || (this.WindowState != FormWindowState.Minimized))
  1100.                                 {
  1101.                                     this.PaintBorder(graphics);
  1102.                                     if (this.BottomBuffer != null)
  1103.                                     {
  1104.                                         graphics.DrawImageUnscaled(this.BottomBuffer, 0, this.Height - Math.Max(this.Engine.BottomBorderHeight, this.cyBorder));
  1105.                                     }
  1106.                                 }
  1107.                             }
  1108.                         }
  1109.                         x61467fe65a98f20c.ReleaseDC(base.Handle, windowDC);
  1110.                     }
  1111.                 }
  1112.                 catch
  1113.                 {
  1114.                 }
  1115.             }
  1116.         }
  1117.         private void x3c424b74aaf6d003()
  1118.         {
  1119.             if (this.BottomBuffer != null)
  1120.             {
  1121.                 this.BottomBuffer.Dispose();
  1122.             }
  1123.             int width = this.Width;
  1124.             int bottomBorderHeight = this.Engine.BottomBorderHeight;
  1125.             int bottom = 0;
  1126.             int cyBorder = this.cyBorder;
  1127.             this.BottomBuffer = new Bitmap(width, Math.Max(bottomBorderHeight, cyBorder));
  1128.             using (Graphics graphics = Graphics.FromImage(this.BottomBuffer))
  1129.             {
  1130.                 Bitmap bitmap;
  1131.                 Rectangle destRect = new Rectangle(0, 0, this.BottomBuffer.Width, this.BottomBuffer.Height);
  1132.                 if (bottomBorderHeight < cyBorder)
  1133.                 {
  1134.                     bottom = cyBorder - bottomBorderHeight;
  1135.                     graphics.FillRectangle(this.Engine.Res.Brushes.SKIN2_FORMCOLOR, Rectangle.FromLTRB(this.Engine.LeftBorderWidth, 0, width - this.Engine.RightBorderWidth, bottom));
  1136.                 }
  1137.                 if (this.Engine.Res.Bools.SKIN2_BOTTOMBORDERTHREESECT)
  1138.                 {
  1139.                     bitmap = this.Engine.Res.Bitmaps.SKIN2_FORMBOTTOMBORDER1;
  1140.                     destRect = new Rectangle(0, bottom, bitmap.Width, bottomBorderHeight);
  1141.                     Rectangle srcRect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1142.                     graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  1143.                     int right = destRect.Right;
  1144.                     bitmap = this.Engine.Res.Bitmaps.SKIN2_FORMBOTTOMBORDER3;
  1145.                     destRect = new Rectangle(width - bitmap.Width, bottom, bitmap.Width, bottomBorderHeight);
  1146.                     srcRect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1147.                     graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
  1148.                     int left = destRect.Left;
  1149.                     bitmap = this.Engine.Res.Bitmaps.SKIN2_FORMBOTTOMBORDER2;
  1150.                     destRect = Rectangle.FromLTRB(right, bottom, left, bottomBorderHeight);
  1151.                     srcRect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1152.                     graphics.DrawImage(bitmap, destRect, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  1153.                 }
  1154.                 else
  1155.                 {
  1156.                     bitmap = this.Engine.Res.Bitmaps.SKIN2_FORMBOTTOMBORDER1;
  1157.                     using (Bitmap bitmap2 = new Bitmap(width, bitmap.Height))
  1158.                     {
  1159.                         using (Graphics graphics2 = Graphics.FromImage(bitmap2))
  1160.                         {
  1161.                             x448fd9ab43628c71.SpitDrawHorizontal(bitmap, graphics2, new Rectangle(0, 0, width, bottomBorderHeight), false);
  1162.                         }
  1163.                         graphics.DrawImageUnscaled(bitmap2, 0, bottom);
  1164.                     }
  1165.                 }
  1166.             }
  1167.         }
  1168.         internal void x52b190e626f65140(bool xde860fba55c41d76)
  1169.         {
  1170.             if (xde860fba55c41d76)
  1171.             {
  1172.                 foreach (object obj2 in this.ControlTable.Values)
  1173.                 {
  1174.                     if (obj2 is xbd3f2493841f18a1)
  1175.                     {
  1176.                         ((xbd3f2493841f18a1) obj2).x52b190e626f65140();
  1177.                     }
  1178.                 }
  1179.             }
  1180.             this.x230e512478b11e00 = false;
  1181.             this.OnCurrentSkinChanged(null, new SkinChangedEventArgs(false));
  1182.             this.ReleaseHandle();
  1183.         }
  1184.         private void x58714ffe12c688d9()
  1185.         {
  1186.             Bitmap bitmap;
  1187.             Rectangle rectangle;
  1188.             if (this.TitleBuffer != null)
  1189.             {
  1190.                 this.TitleBuffer.Dispose();
  1191.             }
  1192.             bool flag = this.Engine.Res.Bools.SKIN2_TITLEFIVESECT;
  1193.             int width = this.Width;
  1194.             int titleHeight = this.TitleHeight;
  1195.             bool flag2 = (this.WindowState == FormWindowState.Minimized) && this.IsMdiChild;
  1196.             this.TitleBuffer = new Bitmap(width, titleHeight);
  1197.             using (Graphics graphics = Graphics.FromImage(this.TitleBuffer))
  1198.             {
  1199.                 Rectangle rectangle2;
  1200.                 if (flag2)
  1201.                 {
  1202.                     bitmap = this.Engine.Res.Bitmaps.SKIN2_MINIMIZEDTITLE;
  1203.                     rectangle = new Rectangle(0, 0, width, titleHeight);
  1204.                     rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1205.                     graphics.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1206.                 }
  1207.                 else
  1208.                 {
  1209.                     int num4;
  1210.                     if (flag)
  1211.                     {
  1212.                         bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR5;
  1213.                     }
  1214.                     else
  1215.                     {
  1216.                         bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3;
  1217.                     }
  1218.                     int x = width - bitmap.Width;
  1219.                     rectangle = new Rectangle(x, 0, bitmap.Width, titleHeight);
  1220.                     rectangle2 = new Rectangle(0, 0, bitmap.Width, titleHeight);
  1221.                     graphics.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1222.                     if (flag)
  1223.                     {
  1224.                         if (x > (this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1.Width + this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3.Width))
  1225.                         {
  1226.                             bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1;
  1227.                             rectangle = new Rectangle(0, 0, bitmap.Width, titleHeight);
  1228.                             rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1229.                             graphics.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1230.                             num4 = bitmap.Width;
  1231.                             bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR2;
  1232.                             rectangle = new Rectangle(num4, 0, this.x6b81454f45088f2e, titleHeight);
  1233.                             rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1234.                             graphics.DrawImage(bitmap, rectangle, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  1235.                             bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3;
  1236.                             rectangle = new Rectangle(rectangle.Right, 0, bitmap.Width, titleHeight);
  1237.                             rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1238.                             graphics.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1239.                             bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR4;
  1240.                             rectangle = Rectangle.FromLTRB(rectangle.Right, 0, x, titleHeight);
  1241.                             rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1242.                             if (rectangle.Width > 0)
  1243.                             {
  1244.                                 graphics.DrawImage(bitmap, rectangle, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY);
  1245.                             }
  1246.                             goto Label_0638;
  1247.                         }
  1248.                         if (x <= 0)
  1249.                         {
  1250.                             goto Label_0638;
  1251.                         }
  1252.                         using (Bitmap bitmap2 = new Bitmap(this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1.Width + this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3.Width, titleHeight))
  1253.                         {
  1254.                             using (Graphics graphics2 = Graphics.FromImage(bitmap2))
  1255.                             {
  1256.                                 bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1;
  1257.                                 rectangle = new Rectangle(0, 0, bitmap.Width, titleHeight);
  1258.                                 rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1259.                                 graphics2.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1260.                                 num4 = bitmap.Width;
  1261.                                 bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR3;
  1262.                                 rectangle = new Rectangle(rectangle.Right, 0, bitmap.Width, titleHeight);
  1263.                                 rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1264.                                 graphics2.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1265.                             }
  1266.                             rectangle2 = new Rectangle(0, 0, bitmap2.Width, titleHeight);
  1267.                             rectangle = new Rectangle(0, 0, x, titleHeight);
  1268.                             graphics.DrawImage(bitmap2, rectangle, rectangle2, GraphicsUnit.Pixel);
  1269.                             goto Label_0638;
  1270.                         }
  1271.                     }
  1272.                     if (x > this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1.Width)
  1273.                     {
  1274.                         bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1;
  1275.                         rectangle = new Rectangle(0, 0, bitmap.Width, titleHeight);
  1276.                         rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1277.                         graphics.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1278.                         num4 = bitmap.Width;
  1279.                         bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR2;
  1280.                         if (x > num4)
  1281.                         {
  1282.                             rectangle = Rectangle.FromLTRB(num4, 0, x, titleHeight);
  1283.                             rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1284.                             graphics.DrawImage(bitmap, rectangle, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, GraphicsUnit.Pixel, x448fd9ab43628c71.DrawImageAttrTileY, null);
  1285.                         }
  1286.                         if (bitmap.Height < titleHeight)
  1287.                         {
  1288.                             Brush brush = this.Engine.Res.Brushes.SKIN2_FORMCOLOR;
  1289.                             graphics.FillRectangle(brush, 0, bitmap.Height, width, titleHeight - bitmap.Height);
  1290.                         }
  1291.                     }
  1292.                     else if (x > 0)
  1293.                     {
  1294.                         using (Bitmap bitmap3 = new Bitmap(this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1.Width, titleHeight))
  1295.                         {
  1296.                             using (Graphics graphics3 = Graphics.FromImage(bitmap3))
  1297.                             {
  1298.                                 bitmap = this.Engine.Res.Bitmaps.SKIN2_TITLEBAR1;
  1299.                                 rectangle = new Rectangle(0, 0, bitmap.Width, titleHeight);
  1300.                                 rectangle2 = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
  1301.                                 graphics3.DrawImage(bitmap, rectangle, rectangle2, GraphicsUnit.Pixel);
  1302.                             }
  1303.                             rectangle2 = new Rectangle(0, 0, bitmap3.Width, titleHeight);
  1304.                             rectangle = new Rectangle(0, 0, x, titleHeight);
  1305.                             graphics.DrawImage(bitmap3, rectangle, rectangle2, GraphicsUnit.Pixel);
  1306.                         }
  1307.                     }
  1308.                 }
  1309.             }
  1310.         Label_0638:
  1311.             if (this.RightToLeftLayout)
  1312.             {
  1313.                 this.TitleBuffer.RotateFlip(RotateFlipType.RotateNoneFlipX);
  1314.             }
  1315.             using (Graphics graphics4 = Graphics.FromImage(this.TitleBuffer))
  1316.             {
  1317.                 if (this.ControlBox && (this.Icon != null))
  1318.                 {
  1319.                     if (this.NCRects == null)
  1320.                     {
  1321.                         this.x271f237e4704798d();
  1322.                     }
  1323.                     rectangle = this.NCRects[3];
  1324.                     using (bitmap = this.Icon.ToBitmap())
  1325.                     {
  1326.                         if ((bitmap.Width != 0x10) || (bitmap.Height != 0x10))
  1327.                         {
  1328.                             using (Image image = bitmap.GetThumbnailImage(0x10, 0x10, null, IntPtr.Zero))
  1329.                             {
  1330.                                 graphics4.DrawImage(image, rectangle, new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
  1331.                                 return;
  1332.                             }
  1333.                         }
  1334.                         graphics4.DrawImageUnscaled(bitmap, rectangle);
  1335.                     }
  1336.                 }
  1337.             }
  1338.         }
  1339.         private void x5a3bdd19fa669e36(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  1340.         {
  1341.             this.DoClose();
  1342.         }
  1343.         private void x6616b01fd7cbc65d(int x30cc7819189f11b6)
  1344.         {
  1345.             int num;
  1346.             if (this.NCRects == null)
  1347.             {
  1348.                 return;
  1349.             }
  1350.             if (!this.CanPaint)
  1351.             {
  1352.                 return;
  1353.             }
  1354.             int index = -1;
  1355.             switch (this.LastMousePosition)
  1356.             {
  1357.                 case 8:
  1358.                     if ((this.WindowState != FormWindowState.Minimized) || !this.IsMdiChild)
  1359.                     {
  1360.                         if (x30cc7819189f11b6 == 8)
  1361.                         {
  1362.                             if (this.IsNCMouseDown == 8)
  1363.                             {
  1364.                                 num = 15;
  1365.                             }
  1366.                             else
  1367.                             {
  1368.                                 num = 14;
  1369.                             }
  1370.                         }
  1371.                         else
  1372.                         {
  1373.                             num = 13;
  1374.                         }
  1375.                     }
  1376.                     else if (x30cc7819189f11b6 != 8)
  1377.                     {
  1378.                         num = 10;
  1379.                     }
  1380.                     else if (this.IsNCMouseDown != 8)
  1381.                     {
  1382.                         num = 11;
  1383.                     }
  1384.                     else
  1385.                     {
  1386.                         num = 12;
  1387.                     }
  1388.                     index = 8;
  1389.                     goto Label_01EE;
  1390.                 case 9:
  1391.                     if (x30cc7819189f11b6 != 9)
  1392.                     {
  1393.                         if (this.WindowState == FormWindowState.Maximized)
  1394.                         {
  1395.                             num = 10;
  1396.                         }
  1397.                         else
  1398.                         {
  1399.                             num = 7;
  1400.                         }
  1401.                     }
  1402.                     else if (this.WindowState != FormWindowState.Maximized)
  1403.                     {
  1404.                         if (this.IsNCMouseDown == 9)
  1405.                         {
  1406.                             num = 9;
  1407.                         }
  1408.                         else
  1409.                         {
  1410.                             num = 8;
  1411.                         }
  1412.                     }
  1413.                     else if (this.IsNCMouseDown != 9)
  1414.                     {
  1415.                         num = 11;
  1416.                     }
  1417.                     else
  1418.                     {
  1419.                         num = 12;
  1420.                     }
  1421.                     index = 9;
  1422.                     goto Label_01EE;
  1423.                 case 20:
  1424.                     if (x30cc7819189f11b6 != 20)
  1425.                     {
  1426.                         num = 0x10;
  1427.                         break;
  1428.                     }
  1429.                     if (this.IsNCMouseDown != 20)
  1430.                     {
  1431.                         num = 0x11;
  1432.                         break;
  1433.                     }
  1434.                     num = 0x12;
  1435.                     break;
  1436.                 case 0x15:
  1437.                     if (x30cc7819189f11b6 != 0x15)
  1438.                     {
  1439.                         num = 4;
  1440.                     }
  1441.                     else if (this.IsNCMouseDown != 0x15)
  1442.                     {
  1443.                         num = 5;
  1444.                     }
  1445.                     else
  1446.                     {
  1447.                         num = 6;
  1448.                     }
  1449.                     index = 0x15;
  1450.                     goto Label_01EE;
  1451.                 default:
  1452.                     switch (x30cc7819189f11b6)
  1453.                     {
  1454.                         case 8:
  1455.                             if ((this.WindowState != FormWindowState.Minimized) || !this.IsMdiChild)
  1456.                             {
  1457.                                 if (this.IsNCMouseDown == 8)
  1458.                                 {
  1459.                                     num = 15;
  1460.                                 }
  1461.                                 else
  1462.                                 {
  1463.                                     num = 14;
  1464.                                 }
  1465.                             }
  1466.                             else if (this.IsNCMouseDown != 8)
  1467.                             {
  1468.                                 num = 11;
  1469.                             }
  1470.                             else
  1471.                             {
  1472.                                 num = 12;
  1473.                             }
  1474.                             index = 8;
  1475.                             goto Label_01EE;
  1476.                         case 9:
  1477.                             if (this.WindowState != FormWindowState.Maximized)
  1478.                             {
  1479.                                 if (this.IsNCMouseDown == 9)
  1480.                                 {
  1481.                                     num = 9;
  1482.                                 }
  1483.                                 else
  1484.                                 {
  1485.                                     num = 8;
  1486.                                 }
  1487.                             }
  1488.                             else if (this.IsNCMouseDown != 9)
  1489.                             {
  1490.                                 num = 11;
  1491.                             }
  1492.                             else
  1493.                             {
  1494.                                 num = 12;
  1495.                             }
  1496.                             index = 9;
  1497.                             goto Label_01EE;
  1498.                         case 20:
  1499.                             if (this.IsNCMouseDown != 20)
  1500.                             {
  1501.                                 num = 0x11;
  1502.                             }
  1503.                             else
  1504.                             {
  1505.                                 num = 0x12;
  1506.                             }
  1507.                             index = 20;
  1508.                             goto Label_01EE;
  1509.                         case 0x15:
  1510.                             if (this.IsNCMouseDown != 0x15)
  1511.                             {
  1512.                                 num = 5;
  1513.                             }
  1514.                             else
  1515.                             {
  1516.                                 num = 6;
  1517.                             }
  1518.                             index = 0x15;
  1519.                             goto Label_01EE;
  1520.                     }
  1521.                     num = 1;
  1522.                     index = -1;
  1523.                     goto Label_01EE;
  1524.             }
  1525.             index = 20;
  1526.         Label_01EE:
  1527.             if (index == -1)
  1528.             {
  1529.                 return;
  1530.             }
  1531.             Bitmap image = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[num];
  1532.             Rectangle srcRect = new Rectangle(0, 0, image.Width, image.Height);
  1533.             IntPtr windowDC = x61467fe65a98f20c.GetWindowDC(base.Handle);
  1534.             if (windowDC == IntPtr.Zero)
  1535.             {
  1536.                 return;
  1537.             }
  1538.             using (Graphics graphics = Graphics.FromHdc(windowDC))
  1539.             {
  1540.                 Rectangle rectangle;
  1541.                 switch (index)
  1542.                 {
  1543.                     case 8:
  1544.                         rectangle = this.NCRects[index];
  1545.                         graphics.DrawImage(this.ButtonBuffer[1], rectangle, srcRect, GraphicsUnit.Pixel);
  1546.                         graphics.DrawImage(image, rectangle, srcRect, GraphicsUnit.Pixel);
  1547.                         goto Label_034A;
  1548.                     case 9:
  1549.                         rectangle = this.NCRects[index];
  1550.                         graphics.DrawImage(this.ButtonBuffer[2], rectangle, srcRect, GraphicsUnit.Pixel);
  1551.                         graphics.DrawImage(image, rectangle, srcRect, GraphicsUnit.Pixel);
  1552.                         goto Label_034A;
  1553.                     case 20:
  1554.                         rectangle = this.NCRects[index];
  1555.                         graphics.DrawImage(this.ButtonBuffer[3], rectangle, srcRect, GraphicsUnit.Pixel);
  1556.                         graphics.DrawImage(image, rectangle, srcRect, GraphicsUnit.Pixel);
  1557.                         goto Label_034A;
  1558.                     case 0x15:
  1559.                         rectangle = this.NCRects[index];
  1560.                         graphics.DrawImage(this.ButtonBuffer[0], rectangle, srcRect, GraphicsUnit.Pixel);
  1561.                         graphics.DrawImage(image, rectangle, srcRect, GraphicsUnit.Pixel);
  1562.                         goto Label_034A;
  1563.                 }
  1564.             }
  1565.         Label_034A:
  1566.             x61467fe65a98f20c.ReleaseDC(base.Handle, windowDC);
  1567.         }
  1568.         private void x814eab16f4e2a468(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  1569.         {
  1570.             this.DoMin();
  1571.         }
  1572.         private void x841c19853f4810d4(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  1573.         {
  1574.             this.DoMax();
  1575.         }
  1576.         private void x9d937faa8065bfbb()
  1577.         {
  1578.             if (this.CaptionBuffer != null)
  1579.             {
  1580.                 this.CaptionBuffer.Dispose();
  1581.                 this.CaptionBuffer = null;
  1582.             }
  1583.             if ((this.TitleBuffer != null) && (this.NCRects != null))
  1584.             {
  1585.                 int formCaptionPosY;
  1586.                 int width = this.TitleBuffer.Width;
  1587.                 int height = this.TitleBuffer.Height;
  1588.                 this.CaptionBuffer = new Bitmap(width, height);
  1589.                 if (this.Engine.FormCaptionPosY == -1)
  1590.                 {
  1591.                     formCaptionPosY = this.x0c7b47d7852a0e99();
  1592.                 }
  1593.                 else
  1594.                 {
  1595.                     formCaptionPosY = this.Engine.FormCaptionPosY;
  1596.                 }
  1597.                 using (Graphics graphics = Graphics.FromImage(this.CaptionBuffer))
  1598.                 {
  1599.                     Font titleFont;
  1600.                     Color color;
  1601.                     graphics.DrawImageUnscaled(this.TitleBuffer, 0, 0);
  1602.                     if (this.Engine.TitleFont == null)
  1603.                     {
  1604.                         titleFont = x448fd9ab43628c71.TitleFont;
  1605.                     }
  1606.                     else
  1607.                     {
  1608.                         titleFont = this.Engine.TitleFont;
  1609.                     }
  1610.                     StringFormat format = new StringFormat();
  1611.                     format.LineAlignment = StringAlignment.Near;
  1612.                     if ((this.RightToLeft & System.Windows.Forms.RightToLeft.Yes) == System.Windows.Forms.RightToLeft.Yes)
  1613.                     {
  1614.                         format.Alignment = StringAlignment.Far;
  1615.                     }
  1616.                     else
  1617.                     {
  1618.                         format.Alignment = StringAlignment.Near;
  1619.                     }
  1620.                     if (this.IsActive)
  1621.                     {
  1622.                         color = this.Engine.Res.Colors.SKIN2_TITLEFONTCOLOR;
  1623.                     }
  1624.                     else
  1625.                     {
  1626.                         color = Color.FromKnownColor(KnownColor.InactiveCaptionText);
  1627.                     }
  1628.                     using (Brush brush = new SolidBrush(color))
  1629.                     {
  1630.                         if ((this.RightToLeft & System.Windows.Forms.RightToLeft.Yes) == System.Windows.Forms.RightToLeft.Yes)
  1631.                         {
  1632.                             graphics.DrawString(this.xa4b5d355cbf01a80, titleFont, brush, Rectangle.FromLTRB((this.x5a29066520654c5a - this.x6b81454f45088f2e) + 4, formCaptionPosY, this.x5a29066520654c5a, this.TitleHeight), format);
  1633.                         }
  1634.                         else
  1635.                         {
  1636.                             graphics.DrawString(this.xa4b5d355cbf01a80, titleFont, brush, Rectangle.FromLTRB(this.x5a29066520654c5a, formCaptionPosY, this.x5a29066520654c5a + this.x6b81454f45088f2e, this.TitleHeight), format);
  1637.                         }
  1638.                     }
  1639.                 }
  1640.                 if (this.ControlBox)
  1641.                 {
  1642.                     Rectangle rectangle;
  1643.                     if (this.ButtonBuffer != null)
  1644.                     {
  1645.                         foreach (Bitmap bitmap in this.ButtonBuffer)
  1646.                         {
  1647.                             if (bitmap != null)
  1648.                             {
  1649.                                 bitmap.Dispose();
  1650.                             }
  1651.                         }
  1652.                     }
  1653.                     this.ButtonBuffer = new Bitmap[4];
  1654.                     if (this.HelpButton)
  1655.                     {
  1656.                         this.ButtonBuffer[0] = new Bitmap(this.NCRects[0x15].Width, this.NCRects[0x15].Height);
  1657.                         using (Graphics graphics2 = Graphics.FromImage(this.ButtonBuffer[0]))
  1658.                         {
  1659.                             rectangle = new Rectangle(0, 0, this.ButtonBuffer[0].Width, this.ButtonBuffer[0].Height);
  1660.                             graphics2.DrawImage(this.TitleBuffer, rectangle, this.NCRects[0x15], GraphicsUnit.Pixel);
  1661.                         }
  1662.                     }
  1663.                     if (this.MinimizeBox)
  1664.                     {
  1665.                         this.ButtonBuffer[1] = new Bitmap(this.NCRects[8].Width, this.NCRects[8].Height);
  1666.                         using (Graphics graphics3 = Graphics.FromImage(this.ButtonBuffer[1]))
  1667.                         {
  1668.                             rectangle = new Rectangle(0, 0, this.ButtonBuffer[1].Width, this.ButtonBuffer[1].Height);
  1669.                             graphics3.DrawImage(this.TitleBuffer, rectangle, this.NCRects[8], GraphicsUnit.Pixel);
  1670.                         }
  1671.                     }
  1672.                     if (this.MaximizeBox)
  1673.                     {
  1674.                         this.ButtonBuffer[2] = new Bitmap(this.NCRects[9].Width, this.NCRects[9].Height);
  1675.                         using (Graphics graphics4 = Graphics.FromImage(this.ButtonBuffer[2]))
  1676.                         {
  1677.                             rectangle = new Rectangle(0, 0, this.ButtonBuffer[2].Width, this.ButtonBuffer[2].Height);
  1678.                             graphics4.DrawImage(this.TitleBuffer, rectangle, this.NCRects[9], GraphicsUnit.Pixel);
  1679.                         }
  1680.                     }
  1681.                     this.ButtonBuffer[3] = new Bitmap(this.NCRects[20].Width, this.NCRects[20].Height);
  1682.                     using (Graphics graphics5 = Graphics.FromImage(this.ButtonBuffer[3]))
  1683.                     {
  1684.                         rectangle = new Rectangle(0, 0, this.ButtonBuffer[3].Width, this.ButtonBuffer[3].Height);
  1685.                         graphics5.DrawImage(this.TitleBuffer, rectangle, this.NCRects[20], GraphicsUnit.Pixel);
  1686.                     }
  1687.                 }
  1688.             }
  1689.         }
  1690.         protected void xd308f013f560f5be(Point x9c79b5ad7b769b12)
  1691.         {
  1692.             this.xd1faceba1dee38cf.MenuCommands[0].Enabled = this.MinimizeBox;
  1693.             this.xd1faceba1dee38cf.MenuCommands[1].Enabled = this.MaximizeBox;
  1694.             this.xd1faceba1dee38cf.TrackPopupTaskBar(x9c79b5ad7b769b12);
  1695.         }
  1696.         private void xfecf8a78f99f2530(Graphics x4b101060f4767186)
  1697.         {
  1698.             if (this.ControlBox)
  1699.             {
  1700.                 int index = 0x10;
  1701.                 Bitmap image = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[index];
  1702.                 x4b101060f4767186.DrawImage(image, this.NCRects[20], 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
  1703.                 if (this.MaximizeBox)
  1704.                 {
  1705.                     if (this.WindowState == FormWindowState.Maximized)
  1706.                     {
  1707.                         index = 10;
  1708.                     }
  1709.                     else
  1710.                     {
  1711.                         index = 7;
  1712.                     }
  1713.                     image = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[index];
  1714.                     x4b101060f4767186.DrawImage(image, this.NCRects[9], 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
  1715.                 }
  1716.                 if (this.MinimizeBox)
  1717.                 {
  1718.                     if ((this.WindowState == FormWindowState.Minimized) && this.IsMdiChild)
  1719.                     {
  1720.                         index = 10;
  1721.                     }
  1722.                     else
  1723.                     {
  1724.                         index = 13;
  1725.                     }
  1726.                     image = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[index];
  1727.                     x4b101060f4767186.DrawImage(image, this.NCRects[8], 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
  1728.                 }
  1729.                 if (this.HelpButton)
  1730.                 {
  1731.                     index = 4;
  1732.                     image = this.Engine.Res.SplitBitmaps.SKIN2_TITLEBUTTONS[index];
  1733.                     x4b101060f4767186.DrawImage(image, this.NCRects[0x15], 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
  1734.                 }
  1735.             }
  1736.         }
  1737.         protected abstract FormBorderStyle BorderStyle { get; }
  1738.         protected virtual bool CanPaint
  1739.         {
  1740.             get
  1741.             {
  1742.                 if ((!this.Engine.RealActive || !this.x230e512478b11e00) || (this.IsDisposed || (this.BorderStyle == FormBorderStyle.None)))
  1743.                 {
  1744.                     return false;
  1745.                 }
  1746.                 if (this.Tag is int)
  1747.                 {
  1748.                     if (((int) this.Tag) == this.Engine.DisableTag)
  1749.                     {
  1750.                         return false;
  1751.                     }
  1752.                 }
  1753.                 else if ((this.Tag is string) && (((string) this.Tag) == this.Engine.DisableTag.ToString()))
  1754.                 {
  1755.                     return false;
  1756.                 }
  1757.                 return true;
  1758.             }
  1759.         }
  1760.         protected virtual bool CanPaintChild
  1761.         {
  1762.             get
  1763.             {
  1764.                 if (!this.Engine.RealActive || this.IsDisposed)
  1765.                 {
  1766.                     return false;
  1767.                 }
  1768.                 if (this.Tag is int)
  1769.                 {
  1770.                     if (((int) this.Tag) == this.Engine.DisableTag)
  1771.                     {
  1772.                         return false;
  1773.                     }
  1774.                 }
  1775.                 else if ((this.Tag is string) && (((string) this.Tag) == this.Engine.DisableTag.ToString()))
  1776.                 {
  1777.                     return false;
  1778.                 }
  1779.                 return this.Engine.RealActive;
  1780.             }
  1781.         }
  1782.         protected virtual bool CanSize
  1783.         {
  1784.             get
  1785.             {
  1786.                 switch (this.BorderStyle)
  1787.                 {
  1788.                     case FormBorderStyle.None:
  1789.                     case FormBorderStyle.FixedSingle:
  1790.                     case FormBorderStyle.Fixed3D:
  1791.                     case FormBorderStyle.FixedDialog:
  1792.                     case FormBorderStyle.FixedToolWindow:
  1793.                         return false;
  1794.                 }
  1795.                 switch (this.WindowState)
  1796.                 {
  1797.                     case FormWindowState.Minimized:
  1798.                     case FormWindowState.Maximized:
  1799.                         return false;
  1800.                 }
  1801.                 return true;
  1802.             }
  1803.         }
  1804.         protected abstract Rectangle ClientRectangle { get; }
  1805.         protected abstract bool ControlBox { get; }
  1806.         protected abstract int Height { get; }
  1807.         protected abstract bool HelpButton { get; }
  1808.         protected abstract System.Drawing.Icon Icon { get; }
  1809.         protected virtual bool IsActive
  1810.         {
  1811.             get
  1812.             {
  1813.                 return this.xfd408d62a1acef9b;
  1814.             }
  1815.             set
  1816.             {
  1817.                 this.xfd408d62a1acef9b = value;
  1818.             }
  1819.         }
  1820.         protected abstract bool IsDisposed { get; }
  1821.         protected abstract bool IsMdiChild { get; }
  1822.         protected abstract bool IsMdiContainer { get; }
  1823.         protected abstract bool MaximizeBox { get; }
  1824.         protected virtual int MenuHeight
  1825.         {
  1826.             get
  1827.             {
  1828.                 return 0;
  1829.             }
  1830.         }
  1831.         protected abstract bool MinimizeBox { get; }
  1832.         protected abstract System.Drawing.Region Region { get; set; }
  1833.         protected abstract System.Windows.Forms.RightToLeft RightToLeft { get; }
  1834.         protected abstract bool RightToLeftLayout { get; }
  1835.         protected abstract object Tag { get; }
  1836.         protected abstract string Text { get; }
  1837.         protected virtual int TitleHeight
  1838.         {
  1839.             get
  1840.             {
  1841.                 return this.Engine.TitleHeight;
  1842.             }
  1843.         }
  1844.         protected abstract int Width { get; }
  1845.         protected virtual FormWindowState WindowState
  1846.         {
  1847.             get
  1848.             {
  1849.                 if (x61467fe65a98f20c.IsIconic(base.Handle))
  1850.                 {
  1851.                     return FormWindowState.Minimized;
  1852.                 }
  1853.                 if (x61467fe65a98f20c.IsZoomed(base.Handle))
  1854.                 {
  1855.                     return FormWindowState.Maximized;
  1856.                 }
  1857.                 return FormWindowState.Normal;
  1858.             }
  1859.             set
  1860.             {
  1861.                 switch (value)
  1862.                 {
  1863.                     case FormWindowState.Normal:
  1864.                         x61467fe65a98f20c.PostMessage(base.Handle, 0x112, (uint) 0xf120, (uint) 0);
  1865.                         return;
  1866.                     case FormWindowState.Minimized:
  1867.                         x61467fe65a98f20c.PostMessage(base.Handle, 0x112, (uint) 0xf020, (uint) 0);
  1868.                         return;
  1869.                     case FormWindowState.Maximized:
  1870.                         x61467fe65a98f20c.PostMessage(base.Handle, 0x112, (uint) 0xf030, (uint) 0);
  1871.                         return;
  1872.                 }
  1873.             }
  1874.         }
  1875.         internal x902c4aee45bfd906 xd1faceba1dee38cf
  1876.         {
  1877.             get
  1878.             {
  1879.                 if (this.xcdc1a69e212e5aa9 == null)
  1880.                 {
  1881.                     this.xcdc1a69e212e5aa9 = new x902c4aee45bfd906(this.Engine);
  1882.                     this.xcdc1a69e212e5aa9.MenuCommands.Add(new x5f4b657f68f87baa(this.Engine.ResSysMenuMin, new EventHandler(this.x814eab16f4e2a468)));
  1883.                     this.xcdc1a69e212e5aa9.MenuCommands.Add(new x5f4b657f68f87baa(this.Engine.ResSysMenuMax, new EventHandler(this.x841c19853f4810d4)));
  1884.                     this.xcdc1a69e212e5aa9.MenuCommands.Add(new x5f4b657f68f87baa(this.Engine.ResSysMenuClose, new EventHandler(this.x5a3bdd19fa669e36)));
  1885.                 }
  1886.                 this.xcdc1a69e212e5aa9.MenuCommands[0].Text = this.Engine.ResSysMenuMin;
  1887.                 this.xcdc1a69e212e5aa9.MenuCommands[1].Text = this.Engine.ResSysMenuMax;
  1888.                 this.xcdc1a69e212e5aa9.MenuCommands[2].Text = this.Engine.ResSysMenuClose;
  1889.                 this.xcdc1a69e212e5aa9.x94975a4c4f1d71c4 = this.RightToLeft;
  1890.                 return this.xcdc1a69e212e5aa9;
  1891.             }
  1892.         }
  1893.     }
  1894. }