一 设计界面
二 编写代码
1 委托的第一种方法(声明 实例化 使用 )
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;
namespace 计算
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public delegate int Calculate(int x, int y); //声明委托——1
int Add(int x, int y) { return x + y; }//加、减、乘、除的方法——2
int Minus(int x, int y) { return x - y; }
int Multiply(int x, int y) { return x * y; }
int Divide(int x, int y) { return x / y; }
private void button1_Click(object sender, EventArgs e)