我正在尝试在富文本框中显示以下内容。这就是我想要展示的
// “计算”按钮计算总工资、税金和净工资,然后在富文本框中使用货币格式显示名称、部门、总工资、税金和净工资
这些在代码的开头声明:
**private const decimal TAX = 0.25m;
private string name="";**
这是计算按钮:
private void CalcButton_Click(object sender, EventArgs e)
{
// Gross pay= (hours * rate)
// Taxes= (25% of gross pay)
// Net pay (gross pay ?taxes)
decimal Gross_pay;
decimal Taxes;
decimal Net_Pay;
decimal annual_salary;
//calculate
Gross_pay = Convert.ToInt32(HoursTextBox.Text) * decimal.Parse(RateTextBox.Text);
Taxes = TAX * Gross_pay;
Net_Pay = Gross_pay - Taxes;
annual_salary = Net_Pay;
//display
DisplayOutPut.Text = NameTextBox.Text;
DisplayOutPut.Text = HoursTextBox.Text;
DisplayOutPut.Text = RateTextBox.Text;
DisplayOutPut.Text = Gross_pay.ToString("C"); // Hours*Rate
DisplayOutPut.Text= Taxes.ToString("C");
DisplayOutPut.Text= Net_Pay.ToString("C");