?? editbookform.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace book
{
/// <summary>
/// EditbookForm 的摘要說明。
/// </summary>
public class EditbookForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.VScrollBar vScrollBar1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label10;
public System.Windows.Forms.TextBox textBox5;
public System.Windows.Forms.DomainUpDown domainUpDown2;
private System.Windows.Forms.Label label9;
public System.Windows.Forms.DomainUpDown domainUpDown1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
public System.Windows.Forms.TextBox textBox4;
public System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
public System.Windows.Forms.TextBox textBox1;
private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
private System.Windows.Forms.MainMenu mainMenu1;
private DataRow BookRecord;
public EditbookForm(DataRow row)
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
BookRecord=row;
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.label10 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.domainUpDown2 = new System.Windows.Forms.DomainUpDown();
this.label9 = new System.Windows.Forms.Label();
this.domainUpDown1 = new System.Windows.Forms.DomainUpDown();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
//
// button2
//
this.button2.Location = new System.Drawing.Point(140, 152);
this.button2.Size = new System.Drawing.Size(72, 24);
this.button2.Text = "取 消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(36, 152);
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.Text = "確 認";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// vScrollBar1
//
this.vScrollBar1.Location = new System.Drawing.Point(220, 8);
this.vScrollBar1.Maximum = 91;
this.vScrollBar1.Size = new System.Drawing.Size(16, 128);
this.vScrollBar1.ValueChanged += new System.EventHandler(this.vScrollBar1_ValueChanged);
//
// panel1
//
this.panel1.Controls.Add(this.panel2);
this.panel1.Location = new System.Drawing.Point(4, 8);
this.panel1.Size = new System.Drawing.Size(216, 128);
//
// panel2
//
this.panel2.Controls.Add(this.label10);
this.panel2.Controls.Add(this.textBox5);
this.panel2.Controls.Add(this.domainUpDown2);
this.panel2.Controls.Add(this.label9);
this.panel2.Controls.Add(this.domainUpDown1);
this.panel2.Controls.Add(this.label8);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.textBox4);
this.panel2.Controls.Add(this.numericUpDown2);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.label5);
this.panel2.Controls.Add(this.numericUpDown1);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.textBox3);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.textBox2);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.textBox1);
this.panel2.Size = new System.Drawing.Size(216, 272);
//
// label10
//
this.label10.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label10.Location = new System.Drawing.Point(8, 248);
this.label10.Size = new System.Drawing.Size(48, 16);
this.label10.Text = "書 號";
//
// textBox5
//
this.textBox5.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.textBox5.Location = new System.Drawing.Point(56, 240);
this.textBox5.Size = new System.Drawing.Size(152, 26);
this.textBox5.Text = "";
this.textBox5.LostFocus += new System.EventHandler(this.bookInfo_LostFocus);
this.textBox5.GotFocus += new System.EventHandler(this.bookInfo_GotFocus);
//
// domainUpDown2
//
this.domainUpDown2.Items.Add("簡裝");
this.domainUpDown2.Items.Add("精裝");
this.domainUpDown2.Location = new System.Drawing.Point(72, 208);
this.domainUpDown2.Size = new System.Drawing.Size(136, 21);
this.domainUpDown2.Text = "簡裝";
//
// label9
//
this.label9.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular);
this.label9.Location = new System.Drawing.Point(8, 208);
this.label9.Size = new System.Drawing.Size(56, 16);
this.label9.Text = "裝幀類型";
//
// domainUpDown1
//
this.domainUpDown1.Items.Add("小說 ");
this.domainUpDown1.Items.Add("文藝 ");
this.domainUpDown1.Items.Add("生活 ");
this.domainUpDown1.Items.Add("經管社科 ");
this.domainUpDown1.Items.Add("科技 ");
this.domainUpDown1.Items.Add("教育 ");
this.domainUpDown1.Items.Add("少兒 ");
this.domainUpDown1.Items.Add("工具書");
this.domainUpDown1.Location = new System.Drawing.Point(72, 176);
this.domainUpDown1.Size = new System.Drawing.Size(136, 21);
this.domainUpDown1.Text = "小說";
//
// label8
//
this.label8.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular);
this.label8.Location = new System.Drawing.Point(8, 176);
this.label8.Size = new System.Drawing.Size(56, 16);
this.label8.Text = "圖書類型";
//
// label7
//
this.label7.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label7.Location = new System.Drawing.Point(8, 144);
this.label7.Size = new System.Drawing.Size(48, 16);
this.label7.Text = "價 格";
//
// textBox4
//
this.textBox4.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.textBox4.Location = new System.Drawing.Point(56, 144);
this.textBox4.Size = new System.Drawing.Size(152, 26);
this.textBox4.Text = "";
this.textBox4.LostFocus += new System.EventHandler(this.bookInfo_LostFocus);
this.textBox4.GotFocus += new System.EventHandler(this.bookInfo_GotFocus);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(138, 112);
this.numericUpDown2.Maximum = new System.Decimal(new int[] {
12,
0,
0,
0});
this.numericUpDown2.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown2.Size = new System.Drawing.Size(54, 21);
this.numericUpDown2.Value = new System.Decimal(new int[] {
1,
0,
0,
0});
//
// label6
//
this.label6.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label6.Location = new System.Drawing.Point(193, 112);
this.label6.Size = new System.Drawing.Size(16, 16);
this.label6.Text = "月";
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label5.Location = new System.Drawing.Point(120, 112);
this.label5.Size = new System.Drawing.Size(16, 16);
this.label5.Text = "年";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(56, 112);
this.numericUpDown1.Maximum = new System.Decimal(new int[] {
2050,
0,
0,
0});
this.numericUpDown1.Minimum = new System.Decimal(new int[] {
1950,
0,
0,
0});
this.numericUpDown1.Size = new System.Drawing.Size(64, 21);
this.numericUpDown1.Value = new System.Decimal(new int[] {
2000,
0,
0,
0});
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular);
this.label4.Location = new System.Drawing.Point(0, 112);
this.label4.Size = new System.Drawing.Size(56, 16);
this.label4.Text = "出版時間";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label3.Location = new System.Drawing.Point(8, 80);
this.label3.Size = new System.Drawing.Size(48, 16);
this.label3.Text = "出版社";
//
// textBox3
//
this.textBox3.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.textBox3.Location = new System.Drawing.Point(56, 72);
this.textBox3.Size = new System.Drawing.Size(152, 26);
this.textBox3.Text = "";
this.textBox3.LostFocus += new System.EventHandler(this.bookInfo_LostFocus);
this.textBox3.GotFocus += new System.EventHandler(this.bookInfo_GotFocus);
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label2.Location = new System.Drawing.Point(8, 48);
this.label2.Size = new System.Drawing.Size(48, 16);
this.label2.Text = "作 者";
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.textBox2.Location = new System.Drawing.Point(56, 40);
this.textBox2.Size = new System.Drawing.Size(152, 26);
this.textBox2.Text = "";
this.textBox2.LostFocus += new System.EventHandler(this.bookInfo_GotFocus);
this.textBox2.GotFocus += new System.EventHandler(this.bookInfo_GotFocus);
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Size = new System.Drawing.Size(48, 16);
this.label1.Text = "書 名";
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.textBox1.Location = new System.Drawing.Point(56, 8);
this.textBox1.Size = new System.Drawing.Size(152, 26);
this.textBox1.Text = "";
this.textBox1.LostFocus += new System.EventHandler(this.bookInfo_LostFocus);
this.textBox1.GotFocus += new System.EventHandler(this.bookInfo_GotFocus);
//
// EditbookForm
//
this.ClientSize = new System.Drawing.Size(240, 191);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.vScrollBar1);
this.Controls.Add(this.panel1);
this.Menu = this.mainMenu1;
this.Text = "編輯圖書";
this.Load += new System.EventHandler(this.EditbookForm_Load);
}
#endregion
private void EditbookForm_Load(object sender, System.EventArgs e)
{
String str;
vScrollBar1.Minimum = 0;
vScrollBar1.Maximum = panel2.Height - panel1.Height;
vScrollBar1.LargeChange = vScrollBar1.Maximum / 5;
vScrollBar1.SmallChange = vScrollBar1.Maximum / 10;
vScrollBar1.Maximum += vScrollBar1.LargeChange;
this.textBox1.Text = BookRecord["title"].ToString();
this.textBox2.Text = BookRecord["author"].ToString();
this.textBox3.Text = BookRecord["publisher"].ToString();
str = BookRecord["publishing_date"].ToString();
this.numericUpDown1.Text = str.Substring(0, 4); //year
this.numericUpDown2.Text = str.Substring(5, str.Length-5); //month
this.textBox4.Text = BookRecord["price"].ToString();
this.domainUpDown1.Text = BookRecord["contentType"].ToString();
this.domainUpDown2.Text = BookRecord["format"].ToString();
this.textBox5.Text = BookRecord["isbn"].ToString();
}
private void button1_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void button2_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void bookInfo_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void bookInfo_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void vScrollBar1_ValueChanged(object sender, System.EventArgs e)
{
panel2.Top = -1 * vScrollBar1.Value;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -