zoukankan      html  css  js  c++  java
  • C# 单线程(不带参数)演示程序

    源代码:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Net;
    using System.Threading;

    namespace WindowsFormsApplication13
    {
        public partial class Form1 : Form
        {
           
            p rivate String html1 = null;
            public String Html1
            {
                get { return this.html1; }
                set { this.html1 = value; }
            }

            public Form1()
            {
                InitializeComponent();
            }

            p rivate void button1_Click(object sender, EventArgs e)
            {
                Thread myThread1;
                myThread1 = new Thread(new ThreadStart(readwebsite));
                myThread1.Start();
            }

            p rivate void readwebsite()
            {
                this.Html1 = gethtml(textBox1.Text.Trim());
                MethodInvoker mi = new MethodInvoker(richtextbox_invokefun);
                this.BeginInvoke(mi);
            }

            p rivate String gethtml(String url)
            {
                WebClient web1 = new WebClient();
                byte[] data1= web1.DownloadData(url);
                String html=Encoding.Default.GetString(data1);
                return html;
            }

            p rivate void richtextbox_invokefun()
            {
                richTextBox1.Text =this.Html1;
            }
        }
    }

    源代码下载

  • 相关阅读:
    ie 火狐兼容集锦
    ie css png
    jQuery插件——autoTextarea-文本框根据输入内容自适应高度
    比onload更快获取图片尺寸(转载)
    数据库性能问题排查
    项目管理_FindBugs的使用
    js动态获取子复选项并设计全选及提交
    SVN使用_获取某版本后改动的文件列表
    存储过程_把字符串转化为结果集
    Spring下如何配置bean
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668476.html
Copyright © 2011-2022 走看看