private void IsMonthComboBox_SelectedIndexChanged(object sender, EventArgs e) { //日薪/月薪切换 var select = IsMonthComboBox.SelectedValue; if (select.GetType().Name == "Int32" && (int)select == 0) { MonthTextBox.Show(); DayLabel1.Hide(); DayLabel2.Hide(); DayTextBox1.Hide(); DayTextBox2.Hide(); DayTextBox1.Text = ""; DayTextBox2.Text = ""; } else { MonthTextBox.Hide(); MonthTextBox.Text = ""; DayLabel1.Show(); DayLabel2.Show(); DayTextBox1.Show(); DayTextBox2.Show(); } }
private void Form1_Load(object sender, EventArgs e) { var selectDic = new Dictionary <int, string>(); selectDic.Add(0, "月薪"); selectDic.Add(1, "日薪"); BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = selectDic; IsMonthComboBox.DataSource = bindingSource; IsMonthComboBox.ValueMember = "Key"; IsMonthComboBox.DisplayMember = "Value"; DayLabel1.Hide(); DayLabel2.Hide(); DayTextBox1.Hide(); DayTextBox2.Hide(); //默认未转正 IsInternshipCheckBox.Checked = true; }