📄 commonqueryform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace CommonComponent.CommonQuery
{
#region QueryForm class
/// <summary>
/// Summary description for CommonQueryForm.
/// </summary>
public class QueryForm : System.Windows.Forms.Form
{
#region Variables and Data
private System.Windows.Forms.Panel pnlAll;
private System.ComponentModel.IContainer components = null;
private CommonQuery query = null;
private int currItemIndex = -1;
private System.Windows.Forms.ComboBox cmbValue;
private System.Windows.Forms.ComboBox cmbOperator;
private System.Windows.Forms.Panel pnlButton;
private System.Windows.Forms.Button btnExecute;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.Button btnOr;
private System.Windows.Forms.ComboBox cmbCondition;
private System.Windows.Forms.ListBox ltbCondition;
private System.Data.SqlClient.SqlCommand command;
private System.Windows.Forms.PictureBox pictureBox2;
private bool isButton = false;
#endregion
#region Constructors and Destructors
public QueryForm(CommonQuery query)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
this.query = query;
}
~QueryForm()
{
Dispose(false);
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(QueryForm));
this.pnlAll = new System.Windows.Forms.Panel();
this.cmbValue = new System.Windows.Forms.ComboBox();
this.cmbOperator = new System.Windows.Forms.ComboBox();
this.pnlButton = new System.Windows.Forms.Panel();
this.btnExecute = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.btnOr = new System.Windows.Forms.Button();
this.cmbCondition = new System.Windows.Forms.ComboBox();
this.ltbCondition = new System.Windows.Forms.ListBox();
this.command = new System.Data.SqlClient.SqlCommand();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pnlAll.SuspendLayout();
this.pnlButton.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlAll.Controls.Add(this.cmbValue);
this.pnlAll.Controls.Add(this.cmbOperator);
this.pnlAll.Controls.Add(this.pnlButton);
this.pnlAll.Controls.Add(this.cmbCondition);
this.pnlAll.Controls.Add(this.ltbCondition);
this.pnlAll.Location = new System.Drawing.Point(3, 41);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(349, 159);
this.pnlAll.TabIndex = 0;
//
// cmbValue
//
this.cmbValue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
this.cmbValue.Location = new System.Drawing.Point(190, 6);
this.cmbValue.Name = "cmbValue";
this.cmbValue.Size = new System.Drawing.Size(155, 20);
this.cmbValue.TabIndex = 2;
this.cmbValue.Tag = "3";
this.cmbValue.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbValue_KeyUp);
//
// cmbOperator
//
this.cmbOperator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbOperator.Items.AddRange(new object[] {
">",
"=",
"<",
">=",
"<=",
"<>",
"LIKE",
"NOT LIKE"});
this.cmbOperator.Location = new System.Drawing.Point(121, 6);
this.cmbOperator.Name = "cmbOperator";
this.cmbOperator.Size = new System.Drawing.Size(64, 20);
this.cmbOperator.TabIndex = 1;
this.cmbOperator.Tag = "2";
this.cmbOperator.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbOperator_KeyUp);
//
// pnlButton
//
this.pnlButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlButton.Controls.Add(this.btnExecute);
this.pnlButton.Controls.Add(this.btnAdd);
this.pnlButton.Controls.Add(this.btnCancel);
this.pnlButton.Controls.Add(this.btnClear);
this.pnlButton.Controls.Add(this.btnOr);
this.pnlButton.Location = new System.Drawing.Point(191, 34);
this.pnlButton.Name = "pnlButton";
this.pnlButton.Size = new System.Drawing.Size(152, 112);
this.pnlButton.TabIndex = 3;
//
// btnExecute
//
this.btnExecute.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExecute.Location = new System.Drawing.Point(3, 77);
this.btnExecute.Name = "btnExecute";
this.btnExecute.Size = new System.Drawing.Size(145, 25);
this.btnExecute.TabIndex = 4;
this.btnExecute.Text = "执行(&R)";
this.btnExecute.Click += new System.EventHandler(this.btnExecute_Click);
//
// btnAdd
//
this.btnAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAdd.ImageIndex = 0;
this.btnAdd.Location = new System.Drawing.Point(2, 9);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(70, 25);
this.btnAdd.TabIndex = 0;
this.btnAdd.Text = "新增(&A)";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnCancel
//
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.Location = new System.Drawing.Point(79, 43);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(70, 25);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnClear
//
this.btnClear.Enabled = false;
this.btnClear.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnClear.ImageIndex = 3;
this.btnClear.Location = new System.Drawing.Point(2, 43);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(70, 25);
this.btnClear.TabIndex = 2;
this.btnClear.Text = "清除(&L)";
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// btnOr
//
this.btnOr.Enabled = false;
this.btnOr.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOr.ImageIndex = 1;
this.btnOr.Location = new System.Drawing.Point(79, 9);
this.btnOr.Name = "btnOr";
this.btnOr.Size = new System.Drawing.Size(70, 25);
this.btnOr.TabIndex = 1;
this.btnOr.Text = "或者(&O)";
this.btnOr.Click += new System.EventHandler(this.btnOr_Click);
//
// cmbCondition
//
this.cmbCondition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCondition.Location = new System.Drawing.Point(5, 6);
this.cmbCondition.Name = "cmbCondition";
this.cmbCondition.Size = new System.Drawing.Size(112, 20);
this.cmbCondition.TabIndex = 0;
this.cmbCondition.Tag = "1";
this.cmbCondition.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbCondition_KeyUp);
this.cmbCondition.SelectedValueChanged += new System.EventHandler(this.cmbCondition_SelectedValueChanged);
//
// ltbCondition
//
this.ltbCondition.ItemHeight = 12;
this.ltbCondition.Location = new System.Drawing.Point(5, 34);
this.ltbCondition.Name = "ltbCondition";
this.ltbCondition.Size = new System.Drawing.Size(179, 112);
this.ltbCondition.TabIndex = 4;
this.ltbCondition.Tag = "";
//
// pictureBox2
//
this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(0, 0);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(352, 40);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
//
// QueryForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(352, 193);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pnlAll);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "QueryForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "通用查询条件编辑器";
this.Load += new System.EventHandler(this.QueryForm_Load);
this.Closed += new System.EventHandler(this.QueryForm_Closed);
this.pnlAll.ResumeLayout(false);
this.pnlButton.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -