📄 allinfo.cs
字号:
using System;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace _3Dmanager
{
/// <summary>
/// AllInfo 的摘要说明。
/// </summary>
public class AllInfo : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public AllInfo()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.AlternatingBackColor = System.Drawing.Color.WhiteSmoke;
this.dataGrid1.BackColor = System.Drawing.Color.Gainsboro;
this.dataGrid1.BackgroundColor = System.Drawing.Color.DarkGray;
this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataGrid1.CaptionBackColor = System.Drawing.Color.DarkKhaki;
this.dataGrid1.CaptionFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid1.CaptionForeColor = System.Drawing.Color.Black;
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.dataGrid1.FlatMode = true;
this.dataGrid1.Font = new System.Drawing.Font("Times New Roman", 9F);
this.dataGrid1.ForeColor = System.Drawing.Color.Black;
this.dataGrid1.GridLineColor = System.Drawing.Color.Silver;
this.dataGrid1.HeaderBackColor = System.Drawing.Color.Black;
this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid1.HeaderForeColor = System.Drawing.Color.White;
this.dataGrid1.LinkColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid1.Location = new System.Drawing.Point(0, 109);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.LightGray;
this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
this.dataGrid1.SelectionBackColor = System.Drawing.Color.Firebrick;
this.dataGrid1.SelectionForeColor = System.Drawing.Color.White;
this.dataGrid1.Size = new System.Drawing.Size(688, 280);
this.dataGrid1.TabIndex = 0;
//
// textBox1
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Location = new System.Drawing.Point(160, 64);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(184, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(80, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 3;
this.label2.Text = "查询条件";
//
// comboBox1
//
this.comboBox1.Items.AddRange(new object[] {
"类别",
"名称",
"提供商"});
this.comboBox1.Location = new System.Drawing.Point(392, 64);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(80, 20);
this.comboBox1.TabIndex = 4;
this.comboBox1.Text = " 请选择";
//
// button1
//
this.button1.Location = new System.Drawing.Point(512, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.TabIndex = 5;
this.button1.Text = "条件查询";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(512, 16);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 24);
this.button2.TabIndex = 6;
this.button2.Text = "查询所有";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(600, 64);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(72, 24);
this.button3.TabIndex = 7;
this.button3.Text = " 退出";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Location = new System.Drawing.Point(40, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(448, 48);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(264, 16);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(88, 24);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "出售商品";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(48, 16);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(96, 24);
this.radioButton1.TabIndex = 0;
this.radioButton1.Text = " 展出商品";
//
// AllInfo
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(688, 389);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.dataGrid1);
this.Name = "AllInfo";
this.Text = "所有商品信息";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button2_Click(object sender, System.EventArgs e)
{
textBox1.Text="";
int i=0;
if(radioButton1.Checked)i=2;
else if(radioButton2.Checked)i=3;
else
{
MessageBox.Show("请选择单选框!");
radioButton1.Focus();
}
System.Data.DataTable dt=_3DLib.SelectAll.getAllInfo(i);
OleDbDataAdapter da=new OleDbDataAdapter();
this.dataGrid1.DataSource=dt;
}
private void groupBox1_Enter(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
string table=null;
if(radioButton1.Checked)
table="展出商品";
else if(radioButton2.Checked)
table="出售商品";
else
{
MessageBox.Show("请选择表!");
return;
}
string tj=comboBox1.Text;
if(tj.Equals(" 请选择"))
{
MessageBox.Show("请选择查询类型!");
comboBox1.Focus();
return;
}
string text=textBox1.Text;
if(text.Equals(""))
{
MessageBox.Show("查询内容不能为空!");
textBox1.Focus();
return;
}
System.Data.DataTable dt=_3DLib.SelectAll.getOneInfo(table,text,tj);
OleDbDataAdapter da=new OleDbDataAdapter();
this.dataGrid1.DataSource=dt;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -