private void checkedComboBox_stateRemove_TextChanged(object sender, EventArgs e) { Global.FilterValueList(this, (Control)sender); #if NO Delegate_filterValue d = new Delegate_filterValue(FileterValueList); this.BeginInvoke(d, new object[] { sender }); #endif }
private void comboBox_class_SelectedIndexChanged(object sender, EventArgs e) { Global.FilterValue(this, (Control)sender); #if NO Delegate_filterValue d = new Delegate_filterValue(FileterValue); this.BeginInvoke(d, new object[] { sender }); #endif }
// 安全版本 public void FilterValueList(Control control) { if (this.InvokeRequired == true) { Delegate_filterValue d = new Delegate_filterValue(__FilterValueList); this.BeginInvoke(d, new object[] { control }); } else { __FilterValueList((Control)control); } }
// 安全版本 public static void FilterValueEx(Control owner, Control control) { Delegate_filterValue d = new Delegate_filterValue(__FilterValueEx); if (owner.Created == false) { __FilterValueEx((Control)control); } else { owner.BeginInvoke(d, new object[] { control }); } }
private void valueTextChanged(object sender, EventArgs e) { this.Changed = true; string strControlName = ""; if (sender is TextBox) { TextBox textbox = (TextBox)sender; strControlName = textbox.Name; } else if (sender is ComboBox) { if (sender == this.comboBox_type) { #if NO Delegate_filterValue d = new Delegate_filterValue(FileterValue); this.BeginInvoke(d, new object[] { sender }); #endif Global.FilterValue(this, (Control)sender); } else if (sender == this.comboBox_orderSuggestion) { FilterValueEx(this, (Control)sender); } ComboBox combobox = (ComboBox)sender; strControlName = combobox.Name; } else if (sender is CheckedComboBox) { if (sender == this.checkedComboBox_state) { #if NO Delegate_filterValue d = new Delegate_filterValue(FileterValueList); this.BeginInvoke(d, new object[] { sender }); #endif Global.FilterValueList(this, (Control)sender); } CheckedComboBox combobox = (CheckedComboBox)sender; strControlName = combobox.Name; } else { Debug.Assert(false, "未处理的类型 " + sender.GetType().ToString()); return; } int nRet = strControlName.IndexOf("_"); if (nRet == -1) { Debug.Assert(false, "textbox名字中没有下划线"); return; } string strLabelName = "label_" + strControlName.Substring(nRet + 1) + "_color"; Label label = (Label)this.tableLayoutPanel_main.Controls[strLabelName]; if (label == null) { Debug.Assert(false, "没有找到名字为 '" + strLabelName + "' 的Label控件"); return; } label.BackColor = this.ColorChanged; }
// 安全版本 /// <summary> /// 过滤控件中的列表值 /// </summary> /// <param name="owner">控件的宿主控件</param> /// <param name="control">控件</param> public static void FilterValueList(Control owner, Control control) { Delegate_filterValue d = new Delegate_filterValue(__FilterValueList); if (owner.Created == false) __FilterValueList((Control)control); else owner.BeginInvoke(d, new object[] { control }); }
// 安全版本 public static void FilterValue(Control owner, Control control) { if (owner.InvokeRequired == true) { Delegate_filterValue d = new Delegate_filterValue(__FilterValue); owner.BeginInvoke(d, new object[] { control }); } else { __FilterValue((Control)control); } }
void comboBox_seller_SelectedIndexChanged(object sender, EventArgs e) { FilterValue((Control)sender); #if NO Delegate_filterValue d = new Delegate_filterValue(__FilterValue); this.Container.BeginInvoke(d, new object[] { sender }); #endif }
// 安全版本 void FilterValue(Control control) { Delegate_filterValue d = new Delegate_filterValue(__FilterValue); if (this.Container.Created == false) __FilterValue((Control)control); else this.Container.BeginInvoke(d, new object[] { control }); }
// 安全版本 void FilterValue(Control control) { if (this.Container.InvokeRequired == true) { Delegate_filterValue d = new Delegate_filterValue(__FilterValue); this.Container.BeginInvoke(d, new object[] { control }); } else { __FilterValue((Control)control); } }