只需一步,快速开始
分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程
HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成
HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子
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.Threading; namespace test1 { public partial class Form1 : Form { Thread Td; private delegate void Addstr(string str); private Addstr addstr; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; addstr = new Addstr(Textbo); Td = new Thread(new ThreadStart(ThreadMange)); Td.IsBackground = true; Td.Start(); } int NTd = 0; public void ThreadMange() { int I = 1; while (I<=2500) { if (NTd < 100) { NTd++; ThreadPool.QueueUserWorkItem(new WaitCallback(Shuzi), I); I++; } Thread.Sleep(50); } } public void Shuzi(object o) { int O = (int)o; textBox1.Invoke(addstr, O.ToString()); } private void Textbo(string str) { textBox1.Text += str + " "; } } }
我来回答
使用道具 举报
站长苏飞 发表于 2014-11-26 08:24 你分明用的是一个线程吧
本版积分规则 发表回复 回帖后跳转到最后一页
|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)
GMT+8, 2025-3-3 06:03
© 2014-2021