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

📄 form1.cs

📁 Csharp实例编程百例.rar
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace FtpExplorer
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	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;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		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

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[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<j;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;}

		}
	}
}

⌨️ 快捷键说明

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