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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Drawing;
  6.     using System.Windows.Forms;
  7.     internal class xbd3f2493841f18a1 : NativeWindow, IDisposable
  8.     {
  9.         protected Color backColor;
  10.         protected Control Ctrl;
  11.         protected xb9506a535e31f22a ctrlMouseState = xb9506a535e31f22a.None;
  12.         protected SkinEngine Engine;
  13.         protected Color fontColor;
  14.         public xa1883d0b59b7005b SkinContextMenu;
  15.         public x095234c5c1abb370 SkinContextMenuStrip;
  16.         protected Hashtable skinControlList = new Hashtable();
  17.         private bool x230e512478b11e00 = true;
  18.         public xbd3f2493841f18a1(Control control, SkinEngine engine)
  19.         {
  20.             this.Ctrl = control;
  21.             this.Engine = engine;
  22.             this.DoInit();
  23.             this.x172fd1e80a81620d();
  24.         }
  25.         public void Dispose()
  26.         {
  27.         }
  28.         protected virtual void DoInit()
  29.         {
  30.             if (this.Ctrl.BackColor != this.Engine.Res.Colors.SKIN2_FORMCOLOR)
  31.             {
  32.                 this.backColor = this.Ctrl.BackColor;
  33.             }
  34.             this.fontColor = this.Ctrl.ForeColor;
  35.             if (this.CanPaint)
  36.             {
  37.                 if (this.ChangeBackColor)
  38.                 {
  39.                     this.Ctrl.BackColor = this.Engine.Res.Colors.SKIN2_FORMCOLOR;
  40.                 }
  41.                 if (this.ChangeFontColor)
  42.                 {
  43.                     this.Ctrl.ForeColor = this.Engine.Res.Colors.SKIN2_CONTROLFONTCOLOR;
  44.                 }
  45.             }
  46.             this.Engine.CurrentSkinChanged += new SkinChanged(this.x8c06ad1b432b98eb);
  47.             this.Ctrl.Paint += new PaintEventHandler(this.x32475e142481d30b);
  48.             this.Ctrl.BackgroundImageChanged += new EventHandler(this.x1f31d31f0e09c076);
  49.             this.Ctrl.EnabledChanged += new EventHandler(this.x02b398f1260ef2d9);
  50.             this.Ctrl.TextChanged += new EventHandler(this.x238e719e4d456cb9);
  51.             this.Ctrl.MouseEnter += new EventHandler(this.x5aa038edd784e0a2);
  52.             this.Ctrl.MouseLeave += new EventHandler(this.x42271d490e21550a);
  53.             this.Ctrl.MouseUp += new MouseEventHandler(this.xa5ecc87221b6cc18);
  54.             this.Ctrl.MouseDown += new MouseEventHandler(this.xd82fdb580ad5d9c2);
  55.             this.Ctrl.KeyDown += new KeyEventHandler(this.xbca0e60879f588a1);
  56.             this.Ctrl.KeyUp += new KeyEventHandler(this.x3d2022a4b24873fe);
  57.             this.Ctrl.GotFocus += new EventHandler(this.x2bf160cd2bad82a5);
  58.             this.Ctrl.BackColorChanged += new EventHandler(this.xcd7553179bfc3f6c);
  59.             if (this.Ctrl.ContextMenu != null)
  60.             {
  61.                 this.SkinContextMenu = new xa1883d0b59b7005b(this.Engine, this.Ctrl.ContextMenu);
  62.             }
  63.             if (this.Ctrl.ContextMenuStrip != null)
  64.             {
  65.                 this.SkinContextMenuStrip = new x095234c5c1abb370(this.Ctrl.ContextMenuStrip, this.Engine);
  66.             }
  67.         }
  68.         protected virtual void DoUnInit()
  69.         {
  70.         }
  71.         protected virtual void OnCurrentSkinChanged(object sender, SkinChangedEventArgs e)
  72.         {
  73.             if (this.CanPaint)
  74.             {
  75.                 this.xb1ee1b6293236c5f();
  76.                 if (this.ChangeBackColor)
  77.                 {
  78.                     this.Ctrl.BackColor = this.Engine.Res.Colors.SKIN2_FORMCOLOR;
  79.                 }
  80.                 if (this.ChangeFontColor)
  81.                 {
  82.                     this.Ctrl.ForeColor = this.Engine.Res.Colors.SKIN2_CONTROLFONTCOLOR;
  83.                 }
  84.             }
  85.             else if (!this.Ctrl.IsDisposed)
  86.             {
  87.                 if (this.ChangeBackColor)
  88.                 {
  89.                     this.Ctrl.BackColor = this.backColor;
  90.                 }
  91.                 if (this.ChangeFontColor)
  92.                 {
  93.                     this.Ctrl.ForeColor = this.fontColor;
  94.                 }
  95.             }
  96.             this.Ctrl.Refresh();
  97.         }
  98.         protected virtual void PaintControl()
  99.         {
  100.         }
  101.         private void x02b398f1260ef2d9(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  102.         {
  103.             if (this.CanPaint)
  104.             {
  105.                 this.PaintControl();
  106.             }
  107.         }
  108.         private void x172fd1e80a81620d()
  109.         {
  110.             this.Ctrl.ControlAdded += new ControlEventHandler(this.xd34eabd7bd15b71a);
  111.             this.Ctrl.ControlRemoved += new ControlEventHandler(this.xf8f5e344dcfab3e8);
  112.             if (this.CanPaint)
  113.             {
  114.                 ArrayList list = new ArrayList();
  115.                 foreach (Control control in this.Ctrl.Controls)
  116.                 {
  117.                     if (!this.skinControlList.ContainsKey(control.Handle))
  118.                     {
  119.                         list.Add(control);
  120.                     }
  121.                 }
  122.                 foreach (Control control2 in list)
  123.                 {
  124.                     if (!this.skinControlList.ContainsKey(control2.Handle))
  125.                     {
  126.                         xbd3f2493841f18a1 xbdffa = xf3f6919ac5d158dc.Create(control2, this.Engine);
  127.                         this.skinControlList.Add(control2.Handle, xbdffa);
  128.                     }
  129.                 }
  130.             }
  131.         }
  132.         private void x1f31d31f0e09c076(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  133.         {
  134.             if (this.CanPaint)
  135.             {
  136.                 this.PaintControl();
  137.             }
  138.         }
  139.         private void x238e719e4d456cb9(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  140.         {
  141.             if (this.CanPaint)
  142.             {
  143.                 this.PaintControl();
  144.             }
  145.         }
  146.         private void x2bf160cd2bad82a5(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  147.         {
  148.             if (this.CanPaint)
  149.             {
  150.                 this.PaintControl();
  151.             }
  152.         }
  153.         private void x32475e142481d30b(object xe0292b9ed559da7d, PaintEventArgs xfbf34718e704c6bc)
  154.         {
  155.             if (this.CanPaint)
  156.             {
  157.                 this.PaintControl();
  158.             }
  159.         }
  160.         private void x3d2022a4b24873fe(object xe0292b9ed559da7d, KeyEventArgs xfbf34718e704c6bc)
  161.         {
  162.             if ((xfbf34718e704c6bc.KeyCode == Keys.Space) || (xfbf34718e704c6bc.KeyCode == Keys.Return))
  163.             {
  164.                 this.ctrlMouseState = xb9506a535e31f22a.None;
  165.                 if (this.CanPaint)
  166.                 {
  167.                     this.PaintControl();
  168.                 }
  169.             }
  170.         }
  171.         private void x42271d490e21550a(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  172.         {
  173.             this.ctrlMouseState = xb9506a535e31f22a.None;
  174.             if (this.CanPaint)
  175.             {
  176.                 this.PaintControl();
  177.             }
  178.         }
  179.         internal void x52b190e626f65140()
  180.         {
  181.             foreach (object obj2 in this.skinControlList.Values)
  182.             {
  183.                 if (obj2 is xbd3f2493841f18a1)
  184.                 {
  185.                     ((xbd3f2493841f18a1) obj2).x52b190e626f65140();
  186.                 }
  187.             }
  188.             this.x230e512478b11e00 = false;
  189.             this.OnCurrentSkinChanged(null, new SkinChangedEventArgs(false));
  190.         }
  191.         private void x5aa038edd784e0a2(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  192.         {
  193.             this.ctrlMouseState = xb9506a535e31f22a.MouseIn;
  194.             if (this.CanPaint)
  195.             {
  196.                 this.PaintControl();
  197.             }
  198.         }
  199.         private void x8c06ad1b432b98eb(object xe0292b9ed559da7d, SkinChangedEventArgs xfbf34718e704c6bc)
  200.         {
  201.             this.OnCurrentSkinChanged(xe0292b9ed559da7d, xfbf34718e704c6bc);
  202.         }
  203.         private void xa5ecc87221b6cc18(object xe0292b9ed559da7d, MouseEventArgs xfbf34718e704c6bc)
  204.         {
  205.             this.ctrlMouseState = xb9506a535e31f22a.MouseIn;
  206.             if (this.CanPaint)
  207.             {
  208.                 this.PaintControl();
  209.             }
  210.         }
  211.         private void xb1ee1b6293236c5f()
  212.         {
  213.             if (this.CanPaint)
  214.             {
  215.                 ArrayList list = new ArrayList();
  216.                 foreach (Control control in this.Ctrl.Controls)
  217.                 {
  218.                     if (!this.skinControlList.ContainsKey(control.Handle))
  219.                     {
  220.                         list.Add(control);
  221.                     }
  222.                 }
  223.                 foreach (Control control2 in list)
  224.                 {
  225.                     if (!this.skinControlList.ContainsKey(control2.Handle))
  226.                     {
  227.                         xbd3f2493841f18a1 xbdffa = xf3f6919ac5d158dc.Create(control2, this.Engine);
  228.                         this.skinControlList.Add(control2.Handle, xbdffa);
  229.                     }
  230.                 }
  231.             }
  232.         }
  233.         private void xbca0e60879f588a1(object xe0292b9ed559da7d, KeyEventArgs xfbf34718e704c6bc)
  234.         {
  235.             if ((xfbf34718e704c6bc.KeyCode == Keys.Space) || (xfbf34718e704c6bc.KeyCode == Keys.Return))
  236.             {
  237.                 this.ctrlMouseState = xb9506a535e31f22a.MouseDown;
  238.                 if (this.CanPaint)
  239.                 {
  240.                     this.PaintControl();
  241.                 }
  242.             }
  243.         }
  244.         private void xcd7553179bfc3f6c(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
  245.         {
  246.             if (this.CanPaint)
  247.             {
  248.                 this.PaintControl();
  249.             }
  250.         }
  251.         private void xd34eabd7bd15b71a(object xe0292b9ed559da7d, ControlEventArgs xfbf34718e704c6bc)
  252.         {
  253.             if (this.CanPaint)
  254.             {
  255.                 Control control = xfbf34718e704c6bc.Control;
  256.                 if (!this.skinControlList.ContainsKey(control.Handle))
  257.                 {
  258.                     xbd3f2493841f18a1 xbdffa = xf3f6919ac5d158dc.Create(control, this.Engine);
  259.                     this.skinControlList.Add(control.Handle, xbdffa);
  260.                 }
  261.             }
  262.         }
  263.         private void xd82fdb580ad5d9c2(object xe0292b9ed559da7d, MouseEventArgs xfbf34718e704c6bc)
  264.         {
  265.             this.ctrlMouseState = xb9506a535e31f22a.MouseDown;
  266.             if (this.CanPaint)
  267.             {
  268.                 this.PaintControl();
  269.             }
  270.         }
  271.         private void xf8f5e344dcfab3e8(object xe0292b9ed559da7d, ControlEventArgs xfbf34718e704c6bc)
  272.         {
  273.         }
  274.         protected bool CanPaint
  275.         {
  276.             get
  277.             {
  278.                 if (!this.x230e512478b11e00)
  279.                 {
  280.                     return false;
  281.                 }
  282.                 if (this.Ctrl.IsDisposed)
  283.                 {
  284.                     return false;
  285.                 }
  286.                 if (!this.Engine.RealActive)
  287.                 {
  288.                     return false;
  289.                 }
  290.                 if (this.Ctrl.Tag is int)
  291.                 {
  292.                     if (((int) this.Ctrl.Tag) == this.Engine.DisableTag)
  293.                     {
  294.                         return false;
  295.                     }
  296.                     return true;
  297.                 }
  298.                 if ((this.Ctrl.Tag is string) && (((string) this.Ctrl.Tag) == this.Engine.DisableTag.ToString()))
  299.                 {
  300.                     return false;
  301.                 }
  302.                 return true;
  303.             }
  304.         }
  305.         protected virtual bool ChangeBackColor
  306.         {
  307.             get
  308.             {
  309.                 return true;
  310.             }
  311.         }
  312.         protected virtual bool ChangeFontColor
  313.         {
  314.             get
  315.             {
  316.                 return false;
  317.             }
  318.         }
  319.     }
  320. }