using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Infragistics.Win.UltraWinEditors; using Infragistics.Win; namespace Core.Mes.Client.Comm.Control { public partial class LabelComboBox : UserControl, LabelControlInterface { public LabelComboBox() { InitializeComponent(); } [Browsable(true), Category("原始系统控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public Label Label { get { return this.label1; } } [Browsable(true), Category("原始系统控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public UltraComboEditor ComboBox { get { return this.comboBox1; } } [Browsable(true), Category("原始系统控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public CheckBox CheckBox { get { return this.checkBox1; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public string Caption { get { return this.label1.Text; } set { this.label1.Text = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool CheckBoxVisible { get { return this.checkBox1.Visible; } set { this.checkBox1.Visible = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool Checked { get { return this.checkBox1.Checked; } set { this.checkBox1.Checked = value; //this.comboBox1.Enabled = checkBox1.Checked; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool ComboBoxEnabled { get { return this.comboBox1.Enabled; } set { this.comboBox1.Enabled = value; } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public object SelecteValue { get { return this.comboBox1.SelectedItem == null ? "" : this.comboBox1.SelectedItem.DataValue; } set { this.comboBox1.Value = value; } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public override string Text { get { return this.comboBox1.Text; } set { this.comboBox1.Text = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public DropDownStyle ComboBoxStyle { get { return this.comboBox1.DropDownStyle; } set { this.comboBox1.DropDownStyle = value; } } private void checkBox1_VisibleChanged(object sender, EventArgs e) { if (checkBox1.Visible == false) { label1.Location = checkBox1.Location; } else { int x = checkBox1.Location.X + checkBox1.Size.Width + 2; label1.Location = new Point(x, checkBox1.Location.Y); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { this.comboBox1.Enabled = checkBox1.Checked; } private void comboBox1_SelectedValueChanged(object sender, EventArgs e) { //try //{ // if (comboBox1.Focused) // { // if (comboBox1.DataSource is DataTable) // { // DataTable dt = (DataTable)comboBox1.DataSource; // //dt.DefaultView.RowFilter = comboBox1.DisplayMember + " LIKE '%" + comboBox1.Text.Trim() + "%'"; // } // comboBox1.DroppedDown = false; // comboBox1.DropDown(); // } //} //catch{}; if (DataBindings["SelecteValue"] != null) { DataBindings["SelecteValue"].WriteValue(); } if (DataBindings["Text"] != null) { DataBindings["Text"].WriteValue(); } } private void comboBox1_TextChanged(object sender, EventArgs e) { } private void label1_MouseClick(object sender, MouseEventArgs e) { if (this.checkBox1.Visible == true) { this.checkBox1.Checked = !checkBox1.Checked; } } } }