/// <summary> /// 初始化 /// </summary> public FrmManagerStudents() { InitializeComponent(); this.comboBox1.DataSource = studentClassService.getAll(); this.comboBox1.DisplayMember = "className"; this.comboBox1.SelectedIndex = -1; this.comboBox1.ValueMember = "id"; // 添加事件 this.comboBox1.SelectedValueChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged); }
public FrmAddStudent() { InitializeComponent(); // 设置班级下拉选择 this.comboBox1.DataSource = studentClassService.getAll(); this.comboBox1.DisplayMember = "className"; this.comboBox1.ValueMember = "id"; this.comboBox1.SelectedIndex = -1; // -1 表示没有选中数值,默认为 1 // Picturebox控件大小不变,图片自动调整大小以适应控件的大小,图片完全显示,且图片长宽比例与控件长宽比例一致。 this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; }