void SkinEngine_BackColorChanged(object sender, System.EventArgs e) { MyForm.ChangeControlColor(); MyForm.ChangeSystemButtonColor(); MyButton.ChangeControlColor(); MyHScrollBar.ChangeControlColor(); MyVScrollBar.ChangeControlColor(); MyToolStrip.ChangeControlColor(); MyToolStripButton.ChangeControlColor(); MyToolStripSeparator.ChangeControlColor(); MyStatusStrip.ChangeControlColor(); foreach (Form form in Application.OpenForms) { form.Refresh(); } }
/// <summary> /// 根据Control返回IMyControl接口 /// </summary> /// <param name="ctl">控件</param> /// <returns></returns> private MyControls.IMyControl GetIMyControl(Control ctl) { MyControls.IMyControl ICtl = null; if (dictIMyControls.ContainsKey(ctl)) { //如果已经存在Hash表中 ICtl = dictIMyControls[ctl] as MyControls.IMyControl; } else { //如果不存在Hash表中 if (ctl is Form) { //如果是窗体 ICtl = new MyControls.MyForm(ctl as Form); } else if (ctl is Button) { //如果是按钮 //如果是StartButton //if (ctl.Tag != null && ctl.Tag is string && ctl.Tag.ToString().Equals("StartButton")) //ICtl = new MyControls.MyStartButton(ctl as Button, this); //else ICtl = new MyControls.MyButton(ctl as Button); } else if (ctl is StatusStrip) { //如果是状态条 ICtl = new MyStatusStrip(ctl as StatusStrip); } else if (ctl is ToolStrip) { //如果是工具条 ICtl = new MyToolStrip(ctl as ToolStrip); } else if (ctl is DataGridView) { //如果是DataGridView ICtl = new MyDataGridView(ctl as DataGridView); } else if (ctl is HScrollBar) { //如果是水平滚动条 ICtl = new MyHScrollBar(ctl as HScrollBar); } else if (ctl is VScrollBar) { //如果是垂直滚动条 ICtl = new MyVScrollBar(ctl as VScrollBar); } /* * else if (ctl is ProgressBar) * { * //如果是进度条 * ICtl = new MyControls.MyProgressBar(ctl as ProgressBar, this); * } * else if (ctl is ListView) * { * //如果是列表 * ICtl = new MyControls.MyListView(ctl as ListView, this); * } * else if (ctl is Label) * { * //如果是Label标签 * ICtl = new MyControls.MyLabel(ctl as Label, this); * } * else if (ctl is GroupBox) * { * //如果是GroupBox * ICtl = new MyControls.MyGroupBox(ctl as GroupBox, this); * } * else if (ctl is TabControl) * { * //如果是TabControl * ICtl = new MyControls.MyTabControl(ctl as TabControl, this); * } * else if (ctl is TrackBar) * { * //如果是TrackBar * ICtl = new MyControls.MyTrackBar(ctl as TrackBar, this); * } * else if (ctl is Panel) * { * //如果是面板 * ICtl = new MyControls.MyPanel(ctl as Panel, this); * } * else if (ctl is CheckBox) * { * //如果是勾选项 * ICtl = new MyControls.MyCheckBox(ctl as CheckBox, this); * } */ //添加到Hash表中 if (ICtl != null) { dictIMyControls.Add(ctl, ICtl); } } return(ICtl); }