using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsApplication1...{ public partial class Form1 : Form ...{ PrintStr Myprint; PrintHandler MyHandler; public Form1() ...{ InitializeComponent(); Myprint = new PrintStr(); MyHandler = null; MyHandler += new PrintHandler(Myprint.CallPrint); // MyHandler += new PrintHandler(Myprint.CallPrint); 输入2次了 } private void button1_Click(object sender, EventArgs e) ...{ if (MyHandler != null) ...{ MyHandler("ddddddd"); } } } public delegate void PrintHandler(string Str);//声明委托 public class PrintStr ...{ public void CallPrint(string StrIn) ...{ Console.WriteLine(StrIn); } }} 终于搞懂 委托了! 欢迎 初学者一起讨论讨论。 下一篇,关于 事件