📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AIToSH
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Resize(object sender, EventArgs e)
{
this.panel1.Location = new System.Drawing.Point(this.Width / 2 - 275, 43);
this.tabControl1.Location = new System.Drawing.Point(5, 244);
this.tabControl1.Size = new System.Drawing.Size(this.Width - 13, this.Height - 278);
this.tabPageTrain.Size = new System.Drawing.Size(this.Width - 17, this.Height - 303);
this.tabPageCar.Size = new System.Drawing.Size(this.Width - 17, this.Height - 303);
this.dataGrid1.Size = new System.Drawing.Size(this.Width - 17, this.Height - 303);
this.dataGrid2.Size = new System.Drawing.Size(this.Width - 17, this.Height - 303);
}
private void Form1_Load(object sender, EventArgs e)
{
DataSet myDS = new DataSet();
DAOCommand dao = new DAOCommand();
dao.search("Select TNO,LeaveTime,ArriveTime,RunTime,Type,Price From TRAIN WHERE TNO='0000'");
dao.MyODA.Fill(myDS,"TRAIN");
dataGrid1.DataSource = myDS.Tables["TRAIN"];
dao.search("SELECT CNO,LeaveTime,ArriveTime,RunTime,LeaveStation,Type,Price FROM CAR WHERE CNO='0000'");
dao.MyODA.Fill(myDS, "CAR");
dataGrid2.DataSource = myDS.Tables["CAR"];
dao.releaseConnection();
}
private void buttonReset_Click(object sender, EventArgs e)
{
radioButton1.Checked = false;
radioButton2.Checked = true;
radioButton3.Checked = false;
radioButton4.Checked = true;
radioButton5.Checked = false;
radioButton6.Checked = true;
radioButton7.Checked = false;
radioButton8.Checked = true;
radioButton9.Checked = false;
radioButton10.Checked = true;
radioButton12.Checked = false;
radioButton11.Checked = true;
DataSet myDS = new DataSet();
DAOCommand dao = new DAOCommand();
dao.search("Select TNO,LeaveTime,ArriveTime,RunTime,Type,Price From TRAIN WHERE TNO='0000'");
dao.MyODA.Fill(myDS, "TRAIN");
dataGrid1.DataSource = myDS.Tables["TRAIN"];
dao.search("SELECT CNO,LeaveTime,ArriveTime,RunTime,LeaveStation,Type,Price FROM CAR WHERE CNO='0000'");
dao.MyODA.Fill(myDS, "CAR");
dataGrid2.DataSource = myDS.Tables["CAR"];
dao.releaseConnection();
}
private void buttonSearch_Click(object sender, EventArgs e)
{
bool time = false;
bool seat = false;
bool quick = false;
bool price = false;
bool town = false;
bool special = true;
if (radioButton1.Checked)
time = true;
if (radioButton3.Checked)
seat = true;
if (radioButton5.Checked)
quick = true;
if (radioButton7.Checked)
price = true;
if (radioButton9.Checked)
town = true;
if (radioButton12.Checked)
special = false;
Reasoning reason = new Reasoning(time, seat, quick, price, town, special);
DataSet myDS = new DataSet();
DAOCommand dao = new DAOCommand();
dao.search(reason.getTrainSql());
dao.MyODA.Fill(myDS,"TRAIN");
dataGrid1.DataSource = myDS.Tables["TRAIN"];
dao.search(reason.getCarSql());
dao.MyODA.Fill(myDS, "CAR");
dataGrid2.DataSource = myDS.Tables["CAR"];
dao.releaseConnection();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -