| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using System.Windows.Forms;
- namespace UAS_LabelMachine.CustomControl
- {
- public partial class SearchTextBox : UserControl
- {
- public SearchTextBox()
- {
- InitializeComponent();
- }
- private string caller;
- private string formName;
- //定义委托
- public delegate void OnTextChange(object sender, EventArgs e);
- //定义事件
- public event OnTextChange UserControlTextChanged;
- //定义委托
- public delegate void Icon_Click(object sender, EventArgs e);
- public event Icon_Click SearchIconClick;
- private void TextBox_TextChanged(object sender, EventArgs e)
- {
- UserControlTextChanged?.Invoke(sender, new EventArgs());
- }
- public override string Text
- {
- get
- {
- return TextBox.Text;
- }
- set
- {
- TextBox.Text = value;
- }
- }
- public string Caller
- {
- get
- {
- return caller;
- }
- set
- {
- caller = value;
- }
- }
- private string[] setValueField;
- public string FormName
- {
- get
- {
- return formName;
- }
- set
- {
- formName = value;
- }
- }
- private string condition;
- public string[] SetValueField
- {
- get
- {
- return setValueField;
- }
- set
- {
- setValueField = value;
- }
- }
- public string Condition
- {
- get
- {
- return condition;
- }
- set
- {
- condition = value;
- }
- }
- public string TableName
- {
- get
- {
- return tableName;
- }
- set
- {
- tableName = value;
- }
- }
- public string SelectField
- {
- get
- {
- return selectField;
- }
- set
- {
- selectField = value;
- }
- }
- private string tableName;
- private string selectField;
- private void Search_Icon_Click(object sender, EventArgs e)
- {
- SearchIconClick?.Invoke(sender, new EventArgs());
-
- DbFind db = new DbFind(Name, tableName, selectField, setValueField, caller, formName, condition);
- if (db.IsAbleDbFind1)
- {
- db.ShowDialog();
- }
- else
- {
- MessageBox.Show("该字段未配置DbFind", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- }
- private void TextBox_Enter(object sender, EventArgs e)
- {
- TextBox.BackColor = System.Drawing.Color.GreenYellow;
- }
- private void TextBox_Leave(object sender, EventArgs e)
- {
- TextBox.BackColor = System.Drawing.Color.White;
- }
- }
- }
|