frmStyleBase.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using CoreFS.CA06;
  5. using Infragistics.Win;
  6. using Infragistics.Win.Misc;
  7. using Infragistics.Win.UltraWinEditors;
  8. using Infragistics.Win.UltraWinGrid;
  9. namespace Core.StlMes.Client.LgCommon
  10. {
  11. public partial class frmStyleBase : FrmBase
  12. {
  13. protected Color _BACKCOLOR = Color.FromArgb(255, 183, 208, 250);
  14. protected Color _BACKCOLOR2 = Color.FromArgb(255, 213, 228, 242);
  15. protected Color _color3 = Color.FromArgb(255, 218, 232, 248);
  16. public frmStyleBase()
  17. {
  18. InitializeComponent();
  19. }
  20. protected override void OnLoad(EventArgs e)
  21. {
  22. base.OnLoad(e);
  23. SetControlStyle(this);
  24. // ClsControlPack.SetUltraGridAppearance(this);
  25. }
  26. private void SetControlAppearance(Control ctrl)
  27. {
  28. try
  29. {
  30. if (ClsControlPack.SpecificType(ctrl, typeof(Form)))
  31. ctrl.BackColor = _BACKCOLOR;
  32. else if (ctrl.GetType().Equals(typeof(Panel)))
  33. ctrl.BackColor = _BACKCOLOR;
  34. else if (ctrl.GetType().Equals(typeof(GroupBox)))
  35. ctrl.BackColor = _BACKCOLOR;
  36. else if (ctrl.GetType().Equals(typeof(ToolStrip)))
  37. ctrl.BackColor = _BACKCOLOR;
  38. else if (ClsControlPack.SpecificType(ctrl, typeof(Label)))
  39. ctrl.BackColor = _BACKCOLOR;
  40. else if (ClsControlPack.SpecificType(ctrl, typeof(UserControl)))
  41. ctrl.BackColor = _BACKCOLOR;
  42. if (ClsControlPack.SpecificType(ctrl, typeof(ControlBase)) &&
  43. !ClsControlPack.SpecificType(ctrl, typeof(EditorButtonControlBase)))
  44. ((ControlBase)ctrl).Appearance.BackColor = _BACKCOLOR;
  45. else if (ClsControlPack.SpecificType(ctrl, typeof(UltraGroupBox)))
  46. {
  47. ((UltraGroupBox)ctrl).ViewStyle = GroupBoxViewStyle.Default;
  48. ((UltraGroupBox)ctrl).HeaderBorderStyle = UIElementBorderStyle.RaisedSoft;
  49. ((UltraGroupBox)ctrl).BorderStyle = GroupBoxBorderStyle.Rectangular3D;
  50. ((UltraGroupBox)ctrl).Appearance.BackColor = _BACKCOLOR2;
  51. ((UltraGroupBox)ctrl).Appearance.BackColor2 = _BACKCOLOR2;
  52. }
  53. else if (ClsControlPack.SpecificType(ctrl, typeof(UltraPanel)))
  54. ((UltraPanel)ctrl).Appearance.BackColor = _BACKCOLOR;
  55. else if (ClsControlPack.SpecificType(ctrl, typeof(UltraGrid)))
  56. {
  57. ((UltraGrid) ctrl).DisplayLayout.Override.HeaderAppearance.BackColor = _BACKCOLOR;
  58. ((UltraGrid)ctrl).DisplayLayout.Appearance.BackColor = _color3;
  59. ((UltraGrid)ctrl).DisplayLayout.Appearance.BackColor2 = _color3;
  60. }
  61. else if (ClsControlPack.SpecificType(ctrl, typeof(UltraExpandableGroupBox)))
  62. ( (UltraExpandableGroupBox)ctrl).ViewStyle = GroupBoxViewStyle.Office2007;
  63. }
  64. catch { }
  65. }
  66. private void SetControlStyle(Control parentCtrl)
  67. {
  68. try
  69. {
  70. SetControlAppearance(parentCtrl);
  71. foreach (Control ctrl in parentCtrl.Controls)
  72. {
  73. SetControlStyle(ctrl);
  74. }
  75. }
  76. catch { }
  77. }
  78. }
  79. }