using System; using System.Drawing; using System.Windows.Forms; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.Misc; using Infragistics.Win.UltraWinEditors; namespace Core.StlMes.Client.LgCommon { public partial class frmPopup : Form { protected Color _BACKCOLOR = Color.FromArgb(202, 222, 247); public frmPopup() { InitializeComponent(); this.KeyPreview = true; SetModelFormStyle(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); SetControlStyle(this); ClsControlPack.SetUltraGridAppearance(this); this.Location = ClsControlPack.GetChildWindowLocation(this.Size); } protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if (e.KeyChar == (char)Keys.Escape) { this.Close(); } } public new Color BackColor { get { return _BACKCOLOR; } set { if (_BACKCOLOR != base.BackColor) base.BackColor = _BACKCOLOR; } } public new FormBorderStyle FormBorderStyle { get { return FormBorderStyle.FixedDialog; } set { base.FormBorderStyle = FormBorderStyle.FixedDialog; } } public new bool MaximizeBox { get { return false; } set { base.MaximizeBox = false; } } public new bool MinimizeBox { get { return false; } set { base.MinimizeBox = false; } } public new FormWindowState WindowState { get { return FormWindowState.Normal; } set { base.WindowState = FormWindowState.Normal; } } public new FormStartPosition StartPosition { get { return FormStartPosition.Manual; } set { base.StartPosition = FormStartPosition.Manual; } } public new bool ShowInTaskbar { get { return false; } set { base.ShowInTaskbar = false; } } public new bool TopMost { get { return true; } set { if (!base.TopMost) base.TopMost = true; } } private void SetModelFormStyle() { this.BackColor = Color.Gainsboro; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.TopMost = true; this.WindowState = FormWindowState.Normal; this.StartPosition = FormStartPosition.Manual; this.ShowInTaskbar = false; } private void SetControlAppearance(Control ctrl) { try { if (ClsControlPack.SpecificType(ctrl, typeof(Form))) ctrl.BackColor = _BACKCOLOR; else if (ctrl.GetType().Equals(typeof(Panel))) ctrl.BackColor = _BACKCOLOR; else if (ctrl.GetType().Equals(typeof(GroupBox))) ctrl.BackColor = _BACKCOLOR; else if (ctrl.GetType().Equals(typeof(ToolStrip))) ctrl.BackColor = _BACKCOLOR; else if (ClsControlPack.SpecificType(ctrl, typeof(Label))) ctrl.BackColor = _BACKCOLOR; else if (ClsControlPack.SpecificType(ctrl, typeof(UserControl))) ctrl.BackColor = _BACKCOLOR; if (ClsControlPack.SpecificType(ctrl, typeof(ControlBase)) && !ClsControlPack.SpecificType(ctrl, typeof(EditorButtonControlBase))) ((ControlBase)ctrl).Appearance.BackColor = _BACKCOLOR; else if (ClsControlPack.SpecificType(ctrl, typeof(UltraGroupBox))) { ((UltraGroupBox)ctrl).ViewStyle = GroupBoxViewStyle.Default; ((UltraGroupBox)ctrl).HeaderBorderStyle = UIElementBorderStyle.RaisedSoft; ((UltraGroupBox)ctrl).BorderStyle = GroupBoxBorderStyle.Rectangular3D; ((UltraGroupBox)ctrl).Appearance.BackColor = _BACKCOLOR; ((UltraGroupBox)ctrl).Appearance.BackColor2 = _BACKCOLOR; } else if (ClsControlPack.SpecificType(ctrl, typeof(UltraPanel))) ((UltraPanel)ctrl).Appearance.BackColor = _BACKCOLOR; } catch { } } private void SetControlStyle(Control parentCtrl) { try { SetControlAppearance(parentCtrl); foreach (Control ctrl in parentCtrl.Controls) { SetControlStyle(ctrl); } } catch { } } } }