首页 > 其他 > 详细

匿名代理的使用方式

时间:2017-12-07 12:43:04      阅读:419      评论:0      收藏:0      [点我收藏+]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace TestDelegate
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Thread thread = new Thread(delegate()
            {
                LoopWriteOutput();
            });
            thread.IsBackground = true;
            thread.Start();
        }

        private void LoopWriteOutput()
        {
            while (true)
            {
                WriteOutput("GO GO GO");
                Thread.Sleep(500);
            }
        }

        private void WriteOutput(string text)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate()
                {
                    WriteOutput(text);
                }));
            }
            else
            {
                textBox1.AppendText(text + Environment.NewLine);
                textBox1.Select(textBox1.Text.Length - 1, 0);
                textBox1.ScrollToCaret();
            }
        }
    }
}

 

匿名代理的使用方式

原文:http://www.cnblogs.com/lgyup/p/7998372.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!