Csharp实例编程百例.rar

源代码在线查看: form1.cs

软件大小: 10159 K
上传用户: pangyi
关键词: Csharp 编程
下载地址: 免注册下载 普通下载 VIP

相关代码

				using System;
				using System.Drawing;
				using System.Collections;
				using System.ComponentModel;
				using System.Windows.Forms;
				using System.Data;
				
				namespace FtpExplorer
				{
					/// 
					/// Form1 的摘要说明。
					/// 
					public class Form1 : System.Windows.Forms.Form
					{
						private int i=0;
						private int j=1;
						private string[] FtpAddress=new String[50];
						private string[] HistoryAddress=new string[50];
						private System.Windows.Forms.Label label1;
						private System.Windows.Forms.Button button1;
						private System.Windows.Forms.Button button2;
						private System.Windows.Forms.Button button3;
						private System.Windows.Forms.ComboBox comboBox1;
						private AxDHTMLEDLib.AxDHTMLEdit axDHTMLEdit1;
				
						/// 
						/// 必需的设计器变量。
						/// 
						private System.ComponentModel.Container components = null;
				
						public Form1()
						{
							//
							// Windows 窗体设计器支持所必需的
							//
							InitializeComponent();
				
							//
							// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
							//
						}
				
						/// 
						/// 清理所有正在使用的资源。
						/// 
						protected override void Dispose( bool disposing )
						{
							if( disposing )
							{
								if (components != null) 
								{
									components.Dispose();
								}
							}
							base.Dispose( disposing );
						}
				
						#region Windows Form Designer generated code
						/// 
						/// 设计器支持所需的方法 - 不要使用代码编辑器修改
						/// 此方法的内容。
						/// 
						private void InitializeComponent()
						{
							System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
							this.label1 = new System.Windows.Forms.Label();
							this.button1 = new System.Windows.Forms.Button();
							this.button2 = new System.Windows.Forms.Button();
							this.button3 = new System.Windows.Forms.Button();
							this.comboBox1 = new System.Windows.Forms.ComboBox();
							this.axDHTMLEdit1 = new AxDHTMLEDLib.AxDHTMLEdit();
							((System.ComponentModel.ISupportInitialize)(this.axDHTMLEdit1)).BeginInit();
							this.SuspendLayout();
							// 
							// label1
							// 
							this.label1.Location = new System.Drawing.Point(0, 32);
							this.label1.Name = "label1";
							this.label1.Size = new System.Drawing.Size(80, 16);
							this.label1.TabIndex = 0;
							this.label1.Text = "FTP Address:";
							// 
							// button1
							// 
							this.button1.Name = "button1";
							this.button1.Size = new System.Drawing.Size(64, 24);
							this.button1.TabIndex = 6;
							this.button1.Text = "Backward";
							this.button1.Click += new System.EventHandler(this.BackBtn_click);
							// 
							// button2
							// 
							this.button2.Location = new System.Drawing.Point(64, 0);
							this.button2.Name = "button2";
							this.button2.Size = new System.Drawing.Size(72, 24);
							this.button2.TabIndex = 7;
							this.button2.Text = "Forward";
							this.button2.Click += new System.EventHandler(this.ForBtn_click);
							// 
							// button3
							// 
							this.button3.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
							this.button3.Location = new System.Drawing.Point(384, 32);
							this.button3.Name = "button3";
							this.button3.Size = new System.Drawing.Size(40, 24);
							this.button3.TabIndex = 8;
							this.button3.Text = "Go!";
							this.button3.Click += new System.EventHandler(this.GoBtn_click);
							// 
							// comboBox1
							// 
							this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
								| System.Windows.Forms.AnchorStyles.Right);
							this.comboBox1.Location = new System.Drawing.Point(72, 32);
							this.comboBox1.Name = "comboBox1";
							this.comboBox1.Size = new System.Drawing.Size(304, 20);
							this.comboBox1.TabIndex = 9;
							// 
							// axDHTMLEdit1
							// 
							this.axDHTMLEdit1.AllowDrop = true;
							this.axDHTMLEdit1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
								| System.Windows.Forms.AnchorStyles.Left) 
								| System.Windows.Forms.AnchorStyles.Right);
							this.axDHTMLEdit1.Enabled = true;
							this.axDHTMLEdit1.Location = new System.Drawing.Point(16, 64);
							this.axDHTMLEdit1.Name = "axDHTMLEdit1";
							this.axDHTMLEdit1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axDHTMLEdit1.OcxState")));
							this.axDHTMLEdit1.Size = new System.Drawing.Size(400, 296);
							this.axDHTMLEdit1.TabIndex = 10;
							// 
							// Form1
							// 
							this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
							this.ClientSize = new System.Drawing.Size(432, 373);
							this.Controls.AddRange(new System.Windows.Forms.Control[] {
																						  this.axDHTMLEdit1,
																						  this.comboBox1,
																						  this.button3,
																						  this.button2,
																						  this.button1,
																						  this.label1});
							this.Name = "Form1";
							this.Text = "FtpExplorer";
							((System.ComponentModel.ISupportInitialize)(this.axDHTMLEdit1)).EndInit();
							this.ResumeLayout(false);
				
						}
						#endregion
				
						/// 
						/// 应用程序的主入口点。
						/// 
						[STAThread]
						static void Main() 
						{
							Application.Run(new Form1());
						}
				
						private void GoBtn_click(object sender, System.EventArgs e)
						{
							HistoryAddress[0]=null;
							bool flag=true;
							HistoryAddress[j]=comboBox1.Text;
							for(int k=0;k							{
								if(HistoryAddress[j]==HistoryAddress[k])
								{
									flag=false;
								}
							}
							if(flag==true)
							{
								comboBox1.Items.Add(comboBox1.Text);
								j++;
							}
							axDHTMLEdit1.LoadURL(comboBox1.Text);
							i++;
							FtpAddress[i]=comboBox1.Text;
						}
				
						private void BackBtn_click(object sender, System.EventArgs e)
						{
							button2.Enabled=true;
							try
							{
								axDHTMLEdit1.LoadURL(FtpAddress[i-1]);
								i=i-1;
							}
							catch{button1.Enabled=false;}
						}
				
						private void ForBtn_click(object sender, System.EventArgs e)
						{
							button1.Enabled=true;
							try
							{
								axDHTMLEdit1.LoadURL(FtpAddress[i+1]);
								i=i+1;
							}
							catch{button2.Enabled=false;}
				
						}
					}
				}
							

相关资源