⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typesettings.cs

📁 C#2.0宝典源码,C#经典书籍,很多例子
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using StudentsMIS.DataAccess;

namespace StudentsMIS.WinForm
{
	/// <summary>
	/// TypeSettings 的摘要说明。
	/// </summary>
	public class TypeSettings : 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.Button btnCancel;
    private System.Windows.Forms.Button btnOK;
    private System.Data.DataSet dataSetTypes;
    private System.Data.DataTable dataTable1;
    private System.Data.DataTable dataTable2;
    private System.Windows.Forms.DataGridTableStyle dataGridTableStyleChangeTypes;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
    private System.Windows.Forms.DataGridTableStyle dataGridTableStylePunishmentTypes;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

    private OleDbCommand objCommand;
    private OleDbDataAdapter objAdapter;
    private OleDbCommandBuilder objCommandBuilder;
    private OleDbCommand objCommandP;
    private OleDbDataAdapter objAdapterP;
    private System.Windows.Forms.Button btnDeleteP;
    private System.Windows.Forms.Button btnTopP;
    private System.Windows.Forms.Button btnBottomP;
    private System.Windows.Forms.DataGrid dataGridC;
    private System.Windows.Forms.DataGrid dataGridP;
    private System.Windows.Forms.Button btnPreviousP;
    private System.Windows.Forms.Button btnNextP;
    private System.Windows.Forms.Button btnBottom;
    private System.Windows.Forms.Button btnNext;
    private System.Windows.Forms.Button btnPrevious;
    private System.Windows.Forms.Button btnTop;
    private System.Windows.Forms.Button btnDelete;
    private System.Windows.Forms.Button btnApplyP;
    private System.Windows.Forms.Button btnApply;
    private OleDbCommandBuilder objCommandBuilderP;

		public TypeSettings()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
      objCommand = CommandBuilder.BuildOleDbCommand("Select * From changeTypes Order By changeType_ID asc");
      objAdapter = new OleDbDataAdapter(objCommand);
      objCommandBuilder = new OleDbCommandBuilder(objAdapter);
      objAdapter.UpdateCommand = objCommandBuilder.GetUpdateCommand();
      objAdapter.DeleteCommand = objCommandBuilder.GetDeleteCommand();
      objAdapter.InsertCommand = objCommandBuilder.GetInsertCommand();
      objAdapter.Fill(dataSetTypes,"ChangeTypes");

      objCommandP = CommandBuilder.BuildOleDbCommand("Select * From punishmentTypes Order By punishmentType_ID asc");
      objAdapterP = new OleDbDataAdapter(objCommandP);
      objCommandBuilderP = new OleDbCommandBuilder(objAdapterP);
      objAdapterP.UpdateCommand = objCommandBuilderP.GetUpdateCommand();
      objAdapterP.InsertCommand = objCommandBuilderP.GetInsertCommand();
      objAdapterP.DeleteCommand = objCommandBuilderP.GetDeleteCommand();
      objAdapterP.Fill(dataSetTypes,"PunishmentTypes");
		}

		/// <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.tabControl1 = new System.Windows.Forms.TabControl();
      this.tabPage1 = new System.Windows.Forms.TabPage();
      this.btnBottom = new System.Windows.Forms.Button();
      this.btnNext = new System.Windows.Forms.Button();
      this.btnPrevious = new System.Windows.Forms.Button();
      this.btnTop = new System.Windows.Forms.Button();
      this.btnDelete = new System.Windows.Forms.Button();
      this.btnApply = new System.Windows.Forms.Button();
      this.dataGridC = new System.Windows.Forms.DataGrid();
      this.dataSetTypes = new System.Data.DataSet();
      this.dataTable1 = new System.Data.DataTable();
      this.dataTable2 = new System.Data.DataTable();
      this.dataGridTableStyleChangeTypes = new System.Windows.Forms.DataGridTableStyle();
      this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.tabPage2 = new System.Windows.Forms.TabPage();
      this.btnBottomP = new System.Windows.Forms.Button();
      this.btnNextP = new System.Windows.Forms.Button();
      this.btnPreviousP = new System.Windows.Forms.Button();
      this.btnTopP = new System.Windows.Forms.Button();
      this.btnDeleteP = new System.Windows.Forms.Button();
      this.btnApplyP = new System.Windows.Forms.Button();
      this.dataGridP = new System.Windows.Forms.DataGrid();
      this.dataGridTableStylePunishmentTypes = new System.Windows.Forms.DataGridTableStyle();
      this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.btnCancel = new System.Windows.Forms.Button();
      this.btnOK = new System.Windows.Forms.Button();
      this.tabControl1.SuspendLayout();
      this.tabPage1.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.dataGridC)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataSetTypes)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataTable2)).BeginInit();
      this.tabPage2.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.dataGridP)).BeginInit();
      this.SuspendLayout();
      // 
      // tabControl1
      // 
      this.tabControl1.Controls.Add(this.tabPage1);
      this.tabControl1.Controls.Add(this.tabPage2);
      this.tabControl1.Location = new System.Drawing.Point(8, 8);
      this.tabControl1.Name = "tabControl1";
      this.tabControl1.SelectedIndex = 0;
      this.tabControl1.Size = new System.Drawing.Size(464, 272);
      this.tabControl1.TabIndex = 1;
      // 
      // tabPage1
      // 
      this.tabPage1.BackColor = System.Drawing.Color.White;
      this.tabPage1.Controls.Add(this.btnBottom);
      this.tabPage1.Controls.Add(this.btnNext);
      this.tabPage1.Controls.Add(this.btnPrevious);
      this.tabPage1.Controls.Add(this.btnTop);
      this.tabPage1.Controls.Add(this.btnDelete);
      this.tabPage1.Controls.Add(this.btnApply);
      this.tabPage1.Controls.Add(this.dataGridC);
      this.tabPage1.Location = new System.Drawing.Point(4, 21);
      this.tabPage1.Name = "tabPage1";
      this.tabPage1.Size = new System.Drawing.Size(456, 247);
      this.tabPage1.TabIndex = 0;
      this.tabPage1.Text = "学籍异动类型设置";
      // 
      // btnBottom
      // 
      this.btnBottom.BackColor = System.Drawing.SystemColors.Control;
      this.btnBottom.Location = new System.Drawing.Point(366, 208);
      this.btnBottom.Name = "btnBottom";
      this.btnBottom.TabIndex = 12;
      this.btnBottom.Text = "末尾";
      this.btnBottom.Click += new System.EventHandler(this.btnBottom_Click);
      // 
      // btnNext
      // 
      this.btnNext.BackColor = System.Drawing.SystemColors.Control;
      this.btnNext.Location = new System.Drawing.Point(366, 176);
      this.btnNext.Name = "btnNext";
      this.btnNext.TabIndex = 11;
      this.btnNext.Text = "下一行";
      this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
      // 
      // btnPrevious
      // 
      this.btnPrevious.BackColor = System.Drawing.SystemColors.Control;
      this.btnPrevious.Location = new System.Drawing.Point(366, 144);
      this.btnPrevious.Name = "btnPrevious";
      this.btnPrevious.TabIndex = 10;
      this.btnPrevious.Text = "上一行";
      this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click);
      // 
      // btnTop
      // 
      this.btnTop.BackColor = System.Drawing.SystemColors.Control;
      this.btnTop.Location = new System.Drawing.Point(366, 112);
      this.btnTop.Name = "btnTop";
      this.btnTop.TabIndex = 9;
      this.btnTop.Text = "顶端";
      this.btnTop.Click += new System.EventHandler(this.btnTop_Click);
      // 
      // btnDelete
      // 
      this.btnDelete.BackColor = System.Drawing.SystemColors.Control;
      this.btnDelete.Location = new System.Drawing.Point(366, 48);
      this.btnDelete.Name = "btnDelete";
      this.btnDelete.TabIndex = 8;
      this.btnDelete.Text = "删除";
      this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
      // 
      // btnApply
      // 
      this.btnApply.BackColor = System.Drawing.SystemColors.Control;
      this.btnApply.Location = new System.Drawing.Point(366, 16);
      this.btnApply.Name = "btnApply";
      this.btnApply.TabIndex = 7;
      this.btnApply.Text = "应用";
      this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
      // 
      // dataGridC
      // 
      this.dataGridC.CaptionVisible = false;
      this.dataGridC.DataMember = "ChangeTypes";
      this.dataGridC.DataSource = this.dataSetTypes;
      this.dataGridC.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.dataGridC.Location = new System.Drawing.Point(15, 15);
      this.dataGridC.Name = "dataGridC";
      this.dataGridC.Size = new System.Drawing.Size(337, 218);
      this.dataGridC.TabIndex = 0;
      this.dataGridC.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
                                                                                          this.dataGridTableStyleChangeTypes});
      // 
      // dataSetTypes
      // 
      this.dataSetTypes.DataSetName = "NewDataSet";
      this.dataSetTypes.Locale = new System.Globalization.CultureInfo("zh-CN");
      this.dataSetTypes.Tables.AddRange(new System.Data.DataTable[] {
                                                                      this.dataTable1,
                                                                      this.dataTable2});
      // 
      // dataTable1
      // 
      this.dataTable1.TableName = "ChangeTypes";
      // 
      // dataTable2
      // 
      this.dataTable2.TableName = "PunishmentTypes";
      // 
      // dataGridTableStyleChangeTypes
      // 
      this.dataGridTableStyleChangeTypes.AllowSorting = false;
      this.dataGridTableStyleChangeTypes.DataGrid = this.dataGridC;
      this.dataGridTableStyleChangeTypes.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
                                                                                                                    this.dataGridTextBoxColumn1,
                                                                                                                    this.dataGridTextBoxColumn2});
      this.dataGridTableStyleChangeTypes.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.dataGridTableStyleChangeTypes.MappingName = "ChangeTypes";
      // 
      // dataGridTextBoxColumn1
      // 
      this.dataGridTextBoxColumn1.Format = "";
      this.dataGridTextBoxColumn1.FormatInfo = null;
      this.dataGridTextBoxColumn1.HeaderText = "类型编号";
      this.dataGridTextBoxColumn1.MappingName = "changeType_ID";
      this.dataGridTextBoxColumn1.Width = 75;
      // 
      // dataGridTextBoxColumn2
      // 
      this.dataGridTextBoxColumn2.Format = "";
      this.dataGridTextBoxColumn2.FormatInfo = null;
      this.dataGridTextBoxColumn2.HeaderText = "类型名称";
      this.dataGridTextBoxColumn2.MappingName = "changeType_name";
      this.dataGridTextBoxColumn2.Width = 75;
      // 
      // tabPage2
      // 
      this.tabPage2.BackColor = System.Drawing.Color.White;
      this.tabPage2.Controls.Add(this.btnBottomP);
      this.tabPage2.Controls.Add(this.btnNextP);
      this.tabPage2.Controls.Add(this.btnPreviousP);
      this.tabPage2.Controls.Add(this.btnTopP);
      this.tabPage2.Controls.Add(this.btnDeleteP);
      this.tabPage2.Controls.Add(this.btnApplyP);
      this.tabPage2.Controls.Add(this.dataGridP);
      this.tabPage2.Location = new System.Drawing.Point(4, 21);
      this.tabPage2.Name = "tabPage2";
      this.tabPage2.Size = new System.Drawing.Size(456, 247);
      this.tabPage2.TabIndex = 1;
      this.tabPage2.Text = "处分类型设置";
      this.tabPage2.Visible = false;
      // 
      // btnBottomP
      // 
      this.btnBottomP.BackColor = System.Drawing.SystemColors.Control;
      this.btnBottomP.Location = new System.Drawing.Point(366, 208);
      this.btnBottomP.Name = "btnBottomP";
      this.btnBottomP.TabIndex = 6;
      this.btnBottomP.Text = "末尾";
      this.btnBottomP.Click += new System.EventHandler(this.btnBottomP_Click);
      // 
      // btnNextP
      // 
      this.btnNextP.BackColor = System.Drawing.SystemColors.Control;
      this.btnNextP.Location = new System.Drawing.Point(366, 176);
      this.btnNextP.Name = "btnNextP";
      this.btnNextP.TabIndex = 5;
      this.btnNextP.Text = "下一行";
      this.btnNextP.Click += new System.EventHandler(this.btnNextP_Click);
      // 
      // btnPreviousP
      // 
      this.btnPreviousP.BackColor = System.Drawing.SystemColors.Control;
      this.btnPreviousP.Location = new System.Drawing.Point(366, 144);
      this.btnPreviousP.Name = "btnPreviousP";
      this.btnPreviousP.TabIndex = 4;
      this.btnPreviousP.Text = "上一行";
      this.btnPreviousP.Click += new System.EventHandler(this.btnPreviousP_Click);
      // 
      // btnTopP
      // 
      this.btnTopP.BackColor = System.Drawing.SystemColors.Control;
      this.btnTopP.Location = new System.Drawing.Point(366, 112);
      this.btnTopP.Name = "btnTopP";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -