使用Panel提示当前位置
第一步:创建一个Windows窗体应用程序项目PanelTip。
第二步:编写计算代码
private void button1_Click(object sender, EventArgse) { doubleordinarySalary = Convert.ToDouble(textBox8.Text); //工作日时薪 doubleholidaySalary = Convert.ToDouble(textBox9.Text); //节假日时薪
//每天工作时间 doublemonday = Convert.ToDouble(textBox1.Text); doubletuesday = Convert.ToDouble(textBox2.Text); doublewednesday = Convert.ToDouble(textBox3.Text); doublethursday = Convert.ToDouble(textBox4.Text); doublefriday = Convert.ToDouble(textBox5.Text); doublesaturday = Convert.ToDouble(textBox6.Text); doublesunday = Convert.ToDouble(textBox7.Text);
//工作日为周一到周五,节点日为周六和周日 doubleweekday = monday + tuesday + wednesday + thursday + friday; doubleholiday = saturday + sunday;
//计算薪水并显示 doubleallSalary = ordinarySalary * weekday + holidaySalary * holiday; textBox10.Text =allSalary.ToString();
}
第三步:编写各个Panel的进入和离开事件代码。
private void panel1_Enter(object sender, EventArgse)
{ panel1.BorderStyle = BorderStyle.Fixed3D; }
private voidpanel1_Leave(object sender, EventArgs e) { panel1.BorderStyle = BorderStyle.FixedSingle; }
private voidpanel2_Enter(object sender, EventArgs e) { panel2.BorderStyle = BorderStyle.Fixed3D; }
private voidpanel2_Leave(object sender, EventArgs e) { panel2.BorderStyle = BorderStyle.FixedSingle; }
private voidpanel3_Enter(object sender, EventArgs e) { panel3.BorderStyle = BorderStyle.Fixed3D; }
private voidpanel3_Leave(object sender, EventArgs e) { panel3.BorderStyle = BorderStyle.FixedSingle; }
|