C#怎么用代表和窗体实现简单计算器
我自己写的代码,写不下去了,求救!!
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 sizheyunsuan
{
public partial class Form1 : Form
{
public static string sun;
public Form1()
{
InitializeComponent();
}
public static void Add(double a, double b)
{
sun =Convert .ToString( a + b);
}
public static void Sub(double a, double b)
{
sun =Convert .ToString ( a - b);
}
public static void Mul(double a, double b)
{
sun =Convert .ToString( a * b);
}
public static void Div(double a, double b)
{
sun =Convert .ToString( a / b);
}
public void button1_Click(object sender, EventArgs e)
{
bool s = true ;
}
public delegate void Wo(double a,double b);
public void Form1_Load(object sender, EventArgs e)
{
double a = Convert.ToDouble(textBox2 .Text );
double b = Convert.ToDouble(textBox3.Text);
Form1.Wo first = new Form1.Wo(Add );
Form1.Wo second = new Form1.Wo(Sub );
Form1.Wo three = new Form1.Wo(Mul );
Form1.Wo fure = new Form1.Wo(Div );
if(s ==true )
{
first(a, b);
textBox4.Text = sun;
}
if (Convert.ToBoolean(button2.Click) == true)
{
second (a, b);
textBox4.Text = sun;
}
if (Convert.ToBoolean(button3.Click) == true)
{
three (a, b);
textBox4.Text = sun;
}
if (Convert.ToBoolean(button4 .Click ) == true)
{
fure (a, b);
textBox4.Text = sun;
}
}
}
}
C# 代表 窗体
补充:.NET技术 , C#