www.pudn.com > classifier.rar > studySelect.cs


using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data.OleDb; 
using System.IO; 
using System.Data; 
 
namespace classifier 
{ 
	///  
	/// studySelect 的摘要说明。 
	///  
	public class studySelect : System.Windows.Forms.Form 
	{ 
		private System.Windows.Forms.GroupBox groupBox1; 
		private System.Windows.Forms.GroupBox groupBox2; 
		private System.Windows.Forms.ComboBox typeList; 
		private System.Windows.Forms.Label label1; 
		private System.Windows.Forms.Button newBtn; 
		private System.Windows.Forms.ListBox fileList; 
		private System.Windows.Forms.Label label2; 
		private System.Windows.Forms.Label label3; 
		private System.Windows.Forms.TextBox viewBox; 
		private System.Windows.Forms.Button addBtn; 
		private System.Windows.Forms.Button delBtn; 
		private System.Windows.Forms.Button viewBtn; 
		private System.Windows.Forms.Button nextBtn; 
		private System.Windows.Forms.TextBox newBox; 
		private System.Windows.Forms.OpenFileDialog openFileDialog1; 
		 
 
		private string[] fileString; 
		///  
		/// 必需的设计器变量。 
		///  
		private System.ComponentModel.Container components = null; 
 
		public studySelect() 
		{ 
			// 
			// Windows 窗体设计器支持所必需的 
			// 
			InitializeComponent(); 
 
			// 
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 
			// 
		} 
 
		///  
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if(components != null) 
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region Windows 窗体设计器生成的代码 
		///  
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
		/// 此方法的内容。 
		///  
		private void InitializeComponent() 
		{ 
			this.groupBox1 = new System.Windows.Forms.GroupBox(); 
			this.groupBox2 = new System.Windows.Forms.GroupBox(); 
			this.typeList = new System.Windows.Forms.ComboBox(); 
			this.label1 = new System.Windows.Forms.Label(); 
			this.newBtn = new System.Windows.Forms.Button(); 
			this.fileList = new System.Windows.Forms.ListBox(); 
			this.label2 = new System.Windows.Forms.Label(); 
			this.label3 = new System.Windows.Forms.Label(); 
			this.viewBox = new System.Windows.Forms.TextBox(); 
			this.addBtn = new System.Windows.Forms.Button(); 
			this.delBtn = new System.Windows.Forms.Button(); 
			this.viewBtn = new System.Windows.Forms.Button(); 
			this.nextBtn = new System.Windows.Forms.Button(); 
			this.newBox = new System.Windows.Forms.TextBox(); 
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); 
			this.groupBox1.SuspendLayout(); 
			this.groupBox2.SuspendLayout(); 
			this.SuspendLayout(); 
			//  
			// groupBox1 
			//  
			this.groupBox1.Controls.Add(this.newBox); 
			this.groupBox1.Controls.Add(this.newBtn); 
			this.groupBox1.Controls.Add(this.label1); 
			this.groupBox1.Controls.Add(this.typeList); 
			this.groupBox1.Location = new System.Drawing.Point(8, 16); 
			this.groupBox1.Name = "groupBox1"; 
			this.groupBox1.Size = new System.Drawing.Size(584, 100); 
			this.groupBox1.TabIndex = 0; 
			this.groupBox1.TabStop = false; 
			this.groupBox1.Text = "类别"; 
			//  
			// groupBox2 
			//  
			this.groupBox2.Controls.Add(this.viewBtn); 
			this.groupBox2.Controls.Add(this.delBtn); 
			this.groupBox2.Controls.Add(this.addBtn); 
			this.groupBox2.Controls.Add(this.viewBox); 
			this.groupBox2.Controls.Add(this.label3); 
			this.groupBox2.Controls.Add(this.label2); 
			this.groupBox2.Controls.Add(this.fileList); 
			this.groupBox2.Location = new System.Drawing.Point(8, 144); 
			this.groupBox2.Name = "groupBox2"; 
			this.groupBox2.Size = new System.Drawing.Size(584, 344); 
			this.groupBox2.TabIndex = 1; 
			this.groupBox2.TabStop = false; 
			this.groupBox2.Text = "学习文件"; 
			//  
			// typeList 
			//  
			this.typeList.Location = new System.Drawing.Point(96, 32); 
			this.typeList.Name = "typeList"; 
			this.typeList.Size = new System.Drawing.Size(168, 20); 
			this.typeList.TabIndex = 0; 
			//  
			// label1 
			//  
			this.label1.Location = new System.Drawing.Point(16, 32); 
			this.label1.Name = "label1"; 
			this.label1.Size = new System.Drawing.Size(72, 23); 
			this.label1.TabIndex = 1; 
			this.label1.Text = "类别名称:"; 
			//  
			// newBtn 
			//  
			this.newBtn.Location = new System.Drawing.Point(488, 32); 
			this.newBtn.Name = "newBtn"; 
			this.newBtn.TabIndex = 2; 
			this.newBtn.Text = "新增"; 
			this.newBtn.Click += new System.EventHandler(this.newBtn_Click); 
			//  
			// fileList 
			//  
			this.fileList.ItemHeight = 12; 
			this.fileList.Location = new System.Drawing.Point(88, 32); 
			this.fileList.Name = "fileList"; 
			this.fileList.Size = new System.Drawing.Size(384, 124); 
			this.fileList.TabIndex = 0; 
			//  
			// label2 
			//  
			this.label2.Location = new System.Drawing.Point(8, 40); 
			this.label2.Name = "label2"; 
			this.label2.Size = new System.Drawing.Size(72, 23); 
			this.label2.TabIndex = 1; 
			this.label2.Text = "文件列表:"; 
			//  
			// label3 
			//  
			this.label3.Location = new System.Drawing.Point(8, 184); 
			this.label3.Name = "label3"; 
			this.label3.Size = new System.Drawing.Size(72, 23); 
			this.label3.TabIndex = 2; 
			this.label3.Text = "文件内容:"; 
			//  
			// viewBox 
			//  
			this.viewBox.Location = new System.Drawing.Point(88, 176); 
			this.viewBox.Multiline = true; 
			this.viewBox.Name = "viewBox"; 
			this.viewBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 
			this.viewBox.Size = new System.Drawing.Size(384, 152); 
			this.viewBox.TabIndex = 3; 
			this.viewBox.Text = ""; 
			//  
			// addBtn 
			//  
			this.addBtn.Location = new System.Drawing.Point(488, 32); 
			this.addBtn.Name = "addBtn"; 
			this.addBtn.TabIndex = 4; 
			this.addBtn.Text = "添加"; 
			this.addBtn.Click += new System.EventHandler(this.addBtn_Click); 
			//  
			// delBtn 
			//  
			this.delBtn.Location = new System.Drawing.Point(488, 80); 
			this.delBtn.Name = "delBtn"; 
			this.delBtn.TabIndex = 5; 
			this.delBtn.Text = "删除"; 
			this.delBtn.Click += new System.EventHandler(this.delBtn_Click); 
			//  
			// viewBtn 
			//  
			this.viewBtn.Location = new System.Drawing.Point(488, 128); 
			this.viewBtn.Name = "viewBtn"; 
			this.viewBtn.TabIndex = 6; 
			this.viewBtn.Text = "查看文件"; 
			this.viewBtn.Click += new System.EventHandler(this.viewBtn_Click); 
			//  
			// nextBtn 
			//  
			this.nextBtn.Location = new System.Drawing.Point(240, 504); 
			this.nextBtn.Name = "nextBtn"; 
			this.nextBtn.TabIndex = 2; 
			this.nextBtn.Text = "下一步"; 
			this.nextBtn.Click += new System.EventHandler(this.nextBtn_Click); 
			//  
			// newBox 
			//  
			this.newBox.Location = new System.Drawing.Point(296, 32); 
			this.newBox.Name = "newBox"; 
			this.newBox.Size = new System.Drawing.Size(176, 21); 
			this.newBox.TabIndex = 3; 
			this.newBox.Text = ""; 
			//  
			// openFileDialog1 
			//  
			this.openFileDialog1.Multiselect = true; 
			this.openFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk); 
			//  
			// studySelect 
			//  
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); 
			this.ClientSize = new System.Drawing.Size(608, 541); 
			this.Controls.Add(this.nextBtn); 
			this.Controls.Add(this.groupBox2); 
			this.Controls.Add(this.groupBox1); 
			this.Name = "studySelect"; 
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 
			this.Text = "学习选择"; 
			this.Load += new System.EventHandler(this.studySelect_Load); 
			this.groupBox1.ResumeLayout(false); 
			this.groupBox2.ResumeLayout(false); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		private void addBtn_Click(object sender, System.EventArgs e) 
		{ 
			openFileDialog1.ShowDialog(); 
		} 
 
		private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e) 
		{ 
			//将选择得到的文件传递给listBox 
//			string fname=""; 
			 
			fileList.Items.Clear();			 
 
			fileString=new string[openFileDialog1.FileNames.Length]; 
			for(int i=0;i