📄 newbook.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data ;
using System.Data.OleDb;
namespace bookmanager
{
/// <summary>
/// Summary description for Newbook.
/// </summary>
public class Newbook : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
public System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox bookmemo;
private System.Windows.Forms.DateTimePicker outdate;
private System.Windows.Forms.TextBox bookpress;
private System.Windows.Forms.TextBox bookprice;
private System.Windows.Forms.TextBox bookauthor;
private System.Windows.Forms.TextBox bookname;
private System.Windows.Forms.TextBox bookcode;
private System.Windows.Forms.DataGrid list;
public string autoID = null;
private DataSet ds = null;
private int currentIndex = -1;
//查询条件 ===================================
public string codeStr = null; //书编号
public string nameStr = null; //书名
public string authorStr = null; //作者
public string pressStr = null; //出版社
public string outdateStr = null; //出版时间
public string costStr = null; //价格
public string lostStr = null; //状态
public string ordernameStr = null;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label label12; //类别
public string memotxtStr = null; //简介
public Newbook( int i)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
LoadSelectItem();
this.tabControl1.SelectedIndex=i;
LoadListForList();
Public.SizeColumnsToContent(this.list,-1,ds.Tables[0],new string[]{"自动编号"});
InitDataGrid();
//两个事件
this.list.MouseDown += new MouseEventHandler(this.ClickInDG);
this.list.MouseUp += new MouseEventHandler(this.UPInDG);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#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()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.list = new System.Windows.Forms.DataGrid();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label11 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.bookmemo = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.outdate = new System.Windows.Forms.DateTimePicker();
this.bookpress = new System.Windows.Forms.TextBox();
this.bookprice = new System.Windows.Forms.TextBox();
this.bookauthor = new System.Windows.Forms.TextBox();
this.bookname = new System.Windows.Forms.TextBox();
this.bookcode = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.button5 = new System.Windows.Forms.Button();
this.label12 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.list)).BeginInit();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(568, 374);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.list);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(560, 349);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "图书列表";
//
// list
//
this.list.CaptionVisible = false;
this.list.DataMember = "";
this.list.Dock = System.Windows.Forms.DockStyle.Fill;
this.list.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.list.Location = new System.Drawing.Point(0, 0);
this.list.Name = "list";
this.list.Size = new System.Drawing.Size(560, 349);
this.list.TabIndex = 0;
this.list.DoubleClick += new System.EventHandler(this.list_DoubleClick);
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
this.tabPage2.Controls.Add(this.label12);
this.tabPage2.Controls.Add(this.button5);
this.tabPage2.Controls.Add(this.label11);
this.tabPage2.Controls.Add(this.button4);
this.tabPage2.Controls.Add(this.button3);
this.tabPage2.Controls.Add(this.button2);
this.tabPage2.Controls.Add(this.button1);
this.tabPage2.Controls.Add(this.comboBox1);
this.tabPage2.Controls.Add(this.textBox8);
this.tabPage2.Controls.Add(this.label10);
this.tabPage2.Controls.Add(this.label9);
this.tabPage2.Controls.Add(this.bookmemo);
this.tabPage2.Controls.Add(this.label8);
this.tabPage2.Controls.Add(this.outdate);
this.tabPage2.Controls.Add(this.bookpress);
this.tabPage2.Controls.Add(this.bookprice);
this.tabPage2.Controls.Add(this.bookauthor);
this.tabPage2.Controls.Add(this.bookname);
this.tabPage2.Controls.Add(this.bookcode);
this.tabPage2.Controls.Add(this.label7);
this.tabPage2.Controls.Add(this.label6);
this.tabPage2.Controls.Add(this.label5);
this.tabPage2.Controls.Add(this.label4);
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.ForeColor = System.Drawing.SystemColors.ControlText;
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(560, 349);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "图书编辑";
//
// label11
//
this.label11.Location = new System.Drawing.Point(352, 72);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(40, 16);
this.label11.TabIndex = 24;
this.label11.Text = "状态:";
//
// button4
//
this.button4.Location = new System.Drawing.Point(344, 312);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(48, 23);
this.button4.TabIndex = 23;
this.button4.Text = "打 印";
//
// button3
//
this.button3.Location = new System.Drawing.Point(296, 312);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(48, 23);
this.button3.TabIndex = 22;
this.button3.Text = "删 除";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(248, 312);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(48, 23);
this.button2.TabIndex = 21;
this.button2.Text = "保 存";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(392, 312);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(48, 23);
this.button1.TabIndex = 20;
this.button1.Text = "取 消";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(344, 136);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(96, 20);
this.comboBox1.TabIndex = 19;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(448, 136);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(48, 21);
this.textBox8.TabIndex = 18;
this.textBox8.Text = "";
this.textBox8.Visible = false;
//
// label10
//
this.label10.Font = new System.Drawing.Font("SimSun", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label10.Location = new System.Drawing.Point(200, 16);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(176, 24);
this.label10.TabIndex = 17;
this.label10.Text = "图书信息编辑";
this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label9
//
this.label9.Location = new System.Drawing.Point(80, 104);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(384, 16);
this.label9.TabIndex = 16;
this.label9.Text = "===============================================================";
//
// bookmemo
//
this.bookmemo.Location = new System.Drawing.Point(160, 216);
this.bookmemo.Multiline = true;
this.bookmemo.Name = "bookmemo";
this.bookmemo.Size = new System.Drawing.Size(280, 88);
this.bookmemo.TabIndex = 15;
this.bookmemo.Text = "";
//
// label8
//
this.label8.Location = new System.Drawing.Point(280, 144);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(72, 16);
this.label8.TabIndex = 14;
this.label8.Text = "书籍类别:";
//
// outdate
//
this.outdate.Location = new System.Drawing.Point(160, 184);
this.outdate.Name = "outdate";
this.outdate.Size = new System.Drawing.Size(112, 21);
this.outdate.TabIndex = 13;
//
// bookpress
//
this.bookpress.Location = new System.Drawing.Point(344, 184);
this.bookpress.Name = "bookpress";
this.bookpress.Size = new System.Drawing.Size(96, 21);
this.bookpress.TabIndex = 12;
this.bookpress.Text = "";
//
// bookprice
//
this.bookprice.Location = new System.Drawing.Point(344, 160);
this.bookprice.Name = "bookprice";
this.bookprice.Size = new System.Drawing.Size(96, 21);
this.bookprice.TabIndex = 11;
this.bookprice.Text = "";
//
// bookauthor
//
this.bookauthor.Location = new System.Drawing.Point(160, 160);
this.bookauthor.Name = "bookauthor";
this.bookauthor.Size = new System.Drawing.Size(112, 21);
this.bookauthor.TabIndex = 9;
this.bookauthor.Text = "";
//
// bookname
//
this.bookname.Location = new System.Drawing.Point(160, 136);
this.bookname.Name = "bookname";
this.bookname.Size = new System.Drawing.Size(112, 21);
this.bookname.TabIndex = 8;
this.bookname.Text = "";
//
// bookcode
//
this.bookcode.Location = new System.Drawing.Point(160, 72);
this.bookcode.Name = "bookcode";
this.bookcode.Size = new System.Drawing.Size(96, 21);
this.bookcode.TabIndex = 7;
this.bookcode.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(80, 216);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 16);
this.label7.TabIndex = 6;
this.label7.Text = "内容简介:";
//
// label6
//
this.label6.Location = new System.Drawing.Point(280, 168);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(64, 16);
this.label6.TabIndex = 5;
this.label6.Text = "价 格:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(80, 192);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(80, 16);
this.label5.TabIndex = 4;
this.label5.Text = "出版日期:";
//
// label4
//
this.label4.Location = new System.Drawing.Point(280, 192);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 16);
this.label4.TabIndex = 3;
this.label4.Text = "出版社:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(80, 168);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 16);
this.label3.TabIndex = 2;
this.label3.Text = "作 者:";
//
// label2
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -