?? inputprint.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication3
{
/// <summary>
/// InputPrint 的摘要說明。
/// </summary>
public class InputPrint : System.Windows.Forms.Form
{
public static string reportNum = "";
public static string reportData = "";
public static string reportKind = "";
private System.Windows.Forms.Label stuLable;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rab1;
private System.Windows.Forms.RadioButton rab2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public InputPrint()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(InputPrint));
this.stuLable = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rab2 = new System.Windows.Forms.RadioButton();
this.rab1 = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// stuLable
//
this.stuLable.BackColor = System.Drawing.Color.Transparent;
this.stuLable.Location = new System.Drawing.Point(16, 24);
this.stuLable.Name = "stuLable";
this.stuLable.Size = new System.Drawing.Size(168, 24);
this.stuLable.TabIndex = 0;
this.stuLable.Text = "學生情況";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(160, 96);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(152, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(40, 96);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(96, 23);
this.label2.TabIndex = 3;
this.label2.Text = "請輸入報告編號";
//
// label3
//
this.label3.Location = new System.Drawing.Point(40, 136);
this.label3.Name = "label3";
this.label3.TabIndex = 4;
this.label3.Text = "請輸入報告日期";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rab2);
this.groupBox1.Controls.Add(this.rab1);
this.groupBox1.Location = new System.Drawing.Point(40, 216);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(360, 48);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
//
// rab2
//
this.rab2.Location = new System.Drawing.Point(200, 16);
this.rab2.Name = "rab2";
this.rab2.TabIndex = 1;
this.rab2.Text = " 查無此人";
//
// rab1
//
this.rab1.Location = new System.Drawing.Point(32, 16);
this.rab1.Name = "rab1";
this.rab1.TabIndex = 0;
this.rab1.Text = " 存在此人";
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 192);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 23);
this.label1.TabIndex = 7;
this.label1.Text = "請選擇打印報告的種類";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(320, 280);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(72, 24);
this.pictureBox1.TabIndex = 8;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter);
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(160, 136);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(152, 21);
this.dateTimePicker1.TabIndex = 9;
//
// InputPrint
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(448, 318);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.stuLable);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputPrint";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "打印設置";
this.Load += new System.EventHandler(this.InputPrint_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void InputPrint_Load(object sender, System.EventArgs e)
{
rab1.Checked = false;
rab2.Checked = false;
if(InputData.stuState == true)
{
stuLable.Text = "經查詢,個人資料全部符合!";
rab1.Checked = true;
}
else
{
stuLable.Text = "經查詢,個人資料有修改部分!";
rab2.Checked = true;
}
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
textBox1.Text = textBox1.Text.Trim();
//textBox2.Text = textBox2.Text.Trim();
// if(textBox1.Text.Length == 0)//||(textBox2.Text.Length == 0))
// {
// MessageBox.Show("編號不能為空!");
// return;
// }
if((rab1.Checked == false)&&(rab2.Checked == false))
{
MessageBox.Show("請選擇要打印報告的種類!");
return;
}
if(rab1.Checked == true)
{
reportKind = "yes";
}
if(rab2.Checked == true)
{
reportKind = "no";
}
reportNum = textBox1.Text;//設置編號
reportData = dateTimePicker1.Value.ToShortDateString();//設置日期
//////////////////////////////////字段長度處理
if( (InputData.trans.name.Length < 4)&&(InputData.trans.name.Length == 1))
{
InputData.trans.name = " "+InputData.trans.name+" ";
}
if( (InputData.trans.name.Length < 4)&&(InputData.trans.name.Length == 2))
{
InputData.trans.name = " "+InputData.trans.name+" ";
}
if( (InputData.trans.name.Length < 4)&&(InputData.trans.name.Length == 3))
{
InputData.trans.name = " "+InputData.trans.name;
}
if(InputData.trans.schName.Length<10)
{
if(InputData.trans.schName.Length == 9)
{
InputData.trans.schName = " "+InputData.trans.schName;
}
if(InputData.trans.schName.Length == 8)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
if(InputData.trans.schName.Length == 7)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
if(InputData.trans.schName.Length == 6)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
if(InputData.trans.schName.Length == 5)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
if(InputData.trans.schName.Length == 4)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
if(InputData.trans.schName.Length == 3)
{
InputData.trans.schName = " "+InputData.trans.schName+" ";
}
}
if(InputData.trans.schCourse.Length < 8)
{
if(InputData.trans.schCourse.Length == 7)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse ;
}
if(InputData.trans.schCourse.Length == 6)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse+" ";
}
if(InputData.trans.schCourse.Length == 5)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse+" ";
}
if(InputData.trans.schCourse.Length == 4)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse+" ";
}
if(InputData.trans.schCourse.Length == 3)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse+" ";
}
if(InputData.trans.schCourse.Length == 2)
{
InputData.trans.schCourse = " "+InputData.trans.schCourse+" ";
}
}
if(InputData.trans.degreeKind.Length<8)
{
if(InputData.trans.degreeKind.Length == 7)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind;
}
if(InputData.trans.degreeKind.Length == 6)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind+" ";
}
if(InputData.trans.degreeKind.Length == 5)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind+" ";
}
if(InputData.trans.degreeKind.Length == 4)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind+" ";
}
if(InputData.trans.degreeKind.Length == 3)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind+" ";
}
if(InputData.trans.degreeKind.Length == 2)
{
InputData.trans.degreeKind = " " + InputData.trans.degreeKind+" ";
}
}
if(InputData.trans.degree.Length<9)
{
if(InputData.trans.degree.Length == 5)
{
InputData.trans.degree = " "+InputData.trans.degree + " ";
}
if(InputData.trans.degree.Length == 6)
{
InputData.trans.degree = " "+InputData.trans.degree + " ";
}
if(InputData.trans.degree.Length == 4)
{
InputData.trans.degree = " "+InputData.trans.degree + " ";
}
if(InputData.trans.degree.Length == 3)
{
InputData.trans.degree = " "+InputData.trans.degree + " ";
}
if(InputData.trans.degree.Length == 2)
{
InputData.trans.degree = " "+InputData.trans.degree + " ";
}
}
/////////////////////////////////
PreviewDialog view = new PreviewDialog();
view.ShowDialog();
}
private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\button-打印報告02.GIF" );
}
private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\button-打印報告01.GIF" );
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -