• 多线程


    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 WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            public delegate void game(string name);
            private void Form1_Load(object sender, EventArgs e)
            {
                game g = new game(test);
                this.Invoke(g, new object[] { "long" });
                gobanghadler += new gobang(Form1_gobanghadler);

                Thread[] ths = new Thread[3];
                for (int i = 0; i < 3; i++)
                {
                  
                    ths[i] = new Thread(new ThreadStart(delegate { MessageBox.Show(i.ToString()); }));
                    ths[i].Name = i.ToString();
                    ths[i].Start();
                }
            }
            public void test(string name)
            {
                MessageBox.Show(name);
            }
            void Form1_gobanghadler(string name)
            {
                throw new NotImplementedException();
            }
            public delegate void gobang(string name);
            public event gobang gobanghadler;

        }
    }

  • 相关阅读:
    倒计时2(小于0时的格式)
    日期 Date()
    倒计时5(超过时间为0:0:0)
    倒计时4
    倒计时3
    Lucene_solr
    Solr与tomcat搭建(搭建好)
    SSM(Spring-SpringMvc-Mybatis)练习
    SpringMvc
    Mybatis(使用)与Spring整合
  • 原文地址:https://www.cnblogs.com/lifeOfIT/p/2802030.html
Copyright © 2020-2023  润新知