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

📄 frmtablewizard.cs

📁 北大青鸟内部资料
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Example_2
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmTableWizard : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label lblSampleTables;
		private System.Windows.Forms.Label lblSampleFields;
		private System.Windows.Forms.Label lblNewFields;
		private System.Windows.Forms.ComboBox cboSampleTables;
		private System.Windows.Forms.ListBox lstNewFields;
		private System.Windows.Forms.ListBox lstSampleFields;
		private System.Windows.Forms.Button btnAdd;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmTableWizard()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// 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.lblSampleTables = new System.Windows.Forms.Label();
			this.lblSampleFields = new System.Windows.Forms.Label();
			this.lblNewFields = new System.Windows.Forms.Label();
			this.cboSampleTables = new System.Windows.Forms.ComboBox();
			this.lstNewFields = new System.Windows.Forms.ListBox();
			this.lstSampleFields = new System.Windows.Forms.ListBox();
			this.btnAdd = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// lblSampleTables
			// 
			this.lblSampleTables.Location = new System.Drawing.Point(8, 16);
			this.lblSampleTables.Name = "lblSampleTables";
			this.lblSampleTables.Size = new System.Drawing.Size(88, 23);
			this.lblSampleTables.TabIndex = 0;
			this.lblSampleTables.Text = "示例表:";
			// 
			// lblSampleFields
			// 
			this.lblSampleFields.Location = new System.Drawing.Point(136, 16);
			this.lblSampleFields.Name = "lblSampleFields";
			this.lblSampleFields.Size = new System.Drawing.Size(88, 23);
			this.lblSampleFields.TabIndex = 1;
			this.lblSampleFields.Text = "示例字段:";
			// 
			// lblNewFields
			// 
			this.lblNewFields.Location = new System.Drawing.Point(304, 16);
			this.lblNewFields.Name = "lblNewFields";
			this.lblNewFields.Size = new System.Drawing.Size(120, 23);
			this.lblNewFields.TabIndex = 1;
			this.lblNewFields.Text = "新表中的字段:";
			// 
			// cboSampleTables
			// 
			this.cboSampleTables.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboSampleTables.Items.AddRange(new object[] {
																 "客户",
																 "职员",
																 "产品"});
			this.cboSampleTables.Location = new System.Drawing.Point(8, 40);
			this.cboSampleTables.Name = "cboSampleTables";
			this.cboSampleTables.TabIndex = 2;
			this.cboSampleTables.SelectedIndexChanged += new System.EventHandler(this.cboSampleTables_SelectedIndexChanged);
			// 
			// lstNewFields
			// 
			this.lstNewFields.Location = new System.Drawing.Point(304, 40);
			this.lstNewFields.Name = "lstNewFields";
			this.lstNewFields.Size = new System.Drawing.Size(120, 108);
			this.lstNewFields.TabIndex = 3;
			// 
			// lstSampleFields
			// 
			this.lstSampleFields.Location = new System.Drawing.Point(136, 40);
			this.lstSampleFields.Name = "lstSampleFields";
			this.lstSampleFields.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
			this.lstSampleFields.Size = new System.Drawing.Size(120, 108);
			this.lstSampleFields.TabIndex = 4;
			// 
			// btnAdd
			// 
			this.btnAdd.Location = new System.Drawing.Point(264, 48);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(32, 23);
			this.btnAdd.TabIndex = 5;
			this.btnAdd.Text = ">";
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// frmTableWizard
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
			this.ClientSize = new System.Drawing.Size(440, 173);
			this.Controls.Add(this.btnAdd);
			this.Controls.Add(this.lstSampleFields);
			this.Controls.Add(this.lstNewFields);
			this.Controls.Add(this.cboSampleTables);
			this.Controls.Add(this.lblSampleFields);
			this.Controls.Add(this.lblSampleTables);
			this.Controls.Add(this.lblNewFields);
			this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Name = "frmTableWizard";
			this.Text = "表向导";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new frmTableWizard());
		}

		private void cboSampleTables_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			this.lstSampleFields.Items.Clear();
			this.lstNewFields.Items.Clear();
			if(String.Compare(this.cboSampleTables.SelectedItem.ToString(),"客户")==0)
			{
				string[] custFields = {"客户标识","公司名称","城市","邮政编码"};

				for(int count = 0 ;count < custFields.Length;count++)
				{
					this.lstSampleFields.Items.Add(custFields[count]);
				}
				
			}
		}

		private void btnAdd_Click(object sender, System.EventArgs e)
		{
			for(int count = 0; count <this.lstSampleFields.SelectedItems.Count;count++)			{
				this.lstNewFields.Items.Add(this.lstSampleFields.SelectedItems[count]);
			}
		}

	}
}

⌨️ 快捷键说明

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