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

📄 form1.cs

📁 C#示例代码,刚刚注册随便找了一个东西测试一下好不好用
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.Name = "Form1";
			this.Text = "网页浏览器-SHARP EXPLORER 1.0";
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.axDHTMLEdit1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

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


		private void menuItem2_Click(object sender, System.EventArgs e)
		{
			try
			{
			
			
			
				openFileDialog1.Filter="ASP.NET网页(*.ASPX)|*.ASPX|HTM(*.HTM)|*.HTM|HTML文件(*.HTML)|*.HTML|所有文件(*.*)|*.*";
				if(openFileDialog1.ShowDialog()==DialogResult.OK)
				{
					comboBox1.Text=openFileDialog1.FileName.ToString();
					
			
						str1[0]=null;
						int n=1;
						str1[j]=comboBox1.Text;
						for(int k=0;k<j;k++)
						{
							if(str1[j]==str1[k])
							{
								n=0;
							}
					
							// MessageBox.Show(n.ToString());
				
						}
					if(n==1)
					{
						comboBox1.Items.Add(comboBox1.Text);
						j++;
					}
					//**********************************************
           
					axDHTMLEdit1.LoadURL(comboBox1.Text);
					i++;
					//**********************************************
					str[i]=comboBox1.Text;
					if(i==(6400-1))
					{
						str=new string[6400*2];
						if(i==6400*2-1)
						{
							str=new string[6400*8];
						}
					}
					if(j==(1024-1))
					{
						str=new string[1024*2];
						if(j==1024*2-1)
						{
							str=new string[1024*8];
						}
					}
			
					//MessageBox.Show(i.ToString());
		
           
				}//if(open....)	
		
			}//第一try

			catch{axDHTMLEdit1.LoadURL("d:\\aa\\error.htm");}

		}

		private void menuItem3_Click(object sender, System.EventArgs e)
		{
			StreamWriter sw=null;
			saveFileDialog1.Filter="网页文件(*.HTM)|*.HTM";
			if(saveFileDialog1.ShowDialog()==DialogResult.OK)
			{
				try
				{
					sw=new StreamWriter(saveFileDialog1.FileName,false,System.Text.Encoding.Unicode);
					sw.Write(axDHTMLEdit1.DocumentHTML);}
				catch(Exception excep){MessageBox.Show(excep.Message);}
				finally{if(sw!=null){sw.Close();}
				}//对应finally{

			} //对应if(saveFileDialog1.ShowDialog()==DialogResult.OK)

		}

		private void menuItem5_Click(object sender, System.EventArgs e)
		{
			Application.Exit();
		}

		private void menuItem10_Click(object sender, System.EventArgs e)
		{
			Form4 form4=new Form4();
			form4.Show();
		}

		private void menuItem11_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show("网页浏览器-SHARP EXPLORER 1.0  周存杰开发。");
		}

		private void menuItem7_Click(object sender, System.EventArgs e)
		{
			Form2 form2=new Form2();
			form2.Show();

		}

		private void menuItem8_Click(object sender, System.EventArgs e)
		{
			Form3 form3=new Form3();
			form3.Show();

		}

		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
				if(e.Button==toolBarButton1){
					toolBarButton2.Enabled=true;
			
					try
					{
		
						axDHTMLEdit1.LoadURL(str[i-1]);
						i=i-1;
			
					}//try

					catch{toolBarButton1.Enabled=false;}
				}
			if(e.Button==toolBarButton2){
				toolBarButton1.Enabled=true;
			
				try
				{
				
					axDHTMLEdit1.LoadURL(str[i+1]);
					i=i+1;
				
					
					
			
				}//try
           
				catch{toolBarButton2.Enabled=false;}
			
			}
			if(e.Button==toolBarButton3)
			{
				try{
											 axDHTMLEdit1.LoadURL(comboBox1.Text);}
										 catch{axDHTMLEdit1.LoadURL("d:\\aa\\error.htm");
				
				}
			}
			if(e.Button==toolBarButton5){
				try
				{
			
			
			
					openFileDialog1.Filter="ASP.NET网页(*.ASPX)|*.ASPX|HTM(*.HTM)|*.HTM|HTML文件(*.HTML)|*.HTML|所有文件(*.*)|*.*";
					if(openFileDialog1.ShowDialog()==DialogResult.OK)
					{
						comboBox1.Text=openFileDialog1.FileName.ToString();
						
			
							str1[0]=null;
							int n=1;
							str1[j]=comboBox1.Text;
							for(int k=0;k<j;k++)
							{
								if(str1[j]==str1[k])
								{
									n=0;
								}
					
								// MessageBox.Show(n.ToString());
				
							}
						if(n==1)
						{
							comboBox1.Items.Add(comboBox1.Text);
							j++;
						}
						//**********************************************
           
						axDHTMLEdit1.LoadURL(comboBox1.Text);
						i++;
						//**********************************************
						str[i]=comboBox1.Text;
						if(i==(6400-1))
						{
							str=new string[6400*2];
							if(i==6400*2-1)
							{
								str=new string[6400*8];
							}
						}
						if(j==(1024-1))
						{
							str=new string[1024*2];
							if(j==1024*2-1)
							{
								str=new string[1024*8];
							}
						}
			
						//MessageBox.Show(i.ToString());
		
           
					}//if(open....)	
		
				}//第一try

				catch{axDHTMLEdit1.LoadURL("d:\\aa\\error.htm");}
			
			}
			if(e.Button==toolBarButton6){
				StreamWriter sw=null;
				saveFileDialog1.Filter="网页文件(*.HTM)|*.HTM";
				if(saveFileDialog1.ShowDialog()==DialogResult.OK)
				{
					try
					{
						sw=new StreamWriter(saveFileDialog1.FileName,false,System.Text.Encoding.Unicode);
						sw.Write(axDHTMLEdit1.DocumentHTML);}
					catch(Exception excep){MessageBox.Show(excep.Message);}
					finally{if(sw!=null){sw.Close();}
					}//对应finally{

				} //对应if(saveFileDialog1.ShowDialog()==DialogResult.OK)
  
			}

		}

		private void button1_Click(object sender, System.EventArgs e)
		{
				try
		 {
			
			     str1[0]=null;
				 int n=1;
				 str1[j]=comboBox1.Text;
				 for(int k=0;k<j;k++)
				 {
					 if(str1[j]==str1[k])
					 {
						 n=0;
					 }
					
					// MessageBox.Show(n.ToString());
				
				 }
				 if(n==1)
				 {
					 comboBox1.Items.Add(comboBox1.Text);
					 j++;
				 }
				 //**********************************************
           
				 axDHTMLEdit1.LoadURL(comboBox1.Text);
				 i++;
				 //**********************************************
				 str[i]=comboBox1.Text;
				 if(i==(6400-1))
				 {
					 str=new string[6400*2];
					 if(i==6400*2-1)
					 {
						 str=new string[6400*8];
					 }
				 }
				 if(j==(1024-1))
				 {
					 str=new string[1024*2];
					 if(j==1024*2-1)
					 {
						 str=new string[1024*8];
					 }
				 }
			
				 //MessageBox.Show(i.ToString());
		
           
			
		
		 }//第一try

		 catch{axDHTMLEdit1.LoadURL("d:\\aa\\error.htm");}
		}

		private void button1_MouseEnter(object sender, System.EventArgs e)
		{
			button1.FlatStyle=FlatStyle.Standard;
			
		}

		private void button1_MouseLeave(object sender, System.EventArgs e)
		{button1.FlatStyle=FlatStyle.Flat;

		}

		
	}
}

⌨️ 快捷键说明

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