private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { int CIndex = e.ColumnIndex; if (CIndex >= 1 && CIndex <= 5) { //re=点击datagridview里组员1-5单元格,获取单元格其中的内容 restu = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); //获取单元格内容中的数字 restu = System.Text.RegularExpressions.Regex.Replace(restu, @"[^0-9]+", ""); //要用这个带参数的构造函数,把教师查看学生这边获取的学生id传到学生信息页面 XPersonalInformationPreview cform = new XPersonalInformationPreview(restu);//实例化一个子窗口 //设置子窗口不显示为顶级窗口 cform.TopLevel = false; //设置子窗口的样式,没有上面的标题栏 cform.FormBorderStyle = FormBorderStyle.None; //填充 cform.Dock = DockStyle.Fill; //清空控件 this.Controls.Clear(); //加入控件 this.Controls.Add(cform); cform.Show(); } } catch (Exception ex) { throw ex; } }
private void Form17_Load(object sender, EventArgs e) { Size size = new Size(1150, 620); //第一个参数是宽度,第二个参数是高度 this.Size = size; pictureBox1.Image = new Bitmap("../../img/横幅2.png"); this.BackgroundImage = Image.FromFile("../../img/背景.jpg"); this.IsMdiContainer = true; this.TitleText = "学生端"; form1 = HomePage.GetIntance; form2 = XTeacherList.GetIntance; form3 = MyVolunteer.GetIntance; form4 = XPersonalInformationPreview.GetIntance; form5 = CheckMentor.GetIntance; form6 = XCheckNotification.GetIntance; form7 = XPersonalCenter.GetIntance; form8 = MyTeam.GetIntance; //初始化按钮 this.initButton(); tabControl1.TabPages[0].Text = "使用步骤介绍"; tabControl1.TabPages[1].Text = "通知"; tabControl1.TabPages[2].Text = "动态"; tabControl1.TabPages[3].Text = "注意事项"; }
private void button4_Click(object sender, EventArgs e) { this.initButton(); this.button4.BackColor = Color.FromArgb(95, 129, 174); XPersonalInformationPreview cform = new XPersonalInformationPreview();//实例化一个子窗口 //设置子窗口不显示为顶级窗口 cform.TopLevel = false; //设置子窗口的样式,没有上面的标题栏 cform.FormBorderStyle = FormBorderStyle.None; //填充 cform.Dock = DockStyle.Fill; //清空控件 this.pnlCenter.Controls.Clear(); //加入控件 this.pnlCenter.Controls.Add(cform); //让窗体显示 cform.Show(); // try // { // this.initButton(); // this.button4.BackColor = Color.FromArgb(95, 129, 174); // Monitor.Enter(this.lockObj); // if (!formSwitchFlag) // { // formSwitchFlag = true; // this.ShowForm(pnlCenter, form4); // formSwitchFlag = false; // } // else // { // return; // } // } //#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 // catch (System.Exception ex) //#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 // { // // // } // finally // { // Monitor.Exit(this.lockObj); // } }
private void button4_Click(object sender, EventArgs e) { this.initButton(); this.button4.BackColor = Color.FromArgb(95, 129, 174); XPersonalInformationPreview cform = new XPersonalInformationPreview();//实例化一个子窗口 //设置子窗口不显示为顶级窗口 cform.TopLevel = false; //设置子窗口的样式,没有上面的标题栏 cform.FormBorderStyle = FormBorderStyle.None; //填充 cform.Dock = DockStyle.Fill; //清空控件 this.pnlCenter.Controls.Clear(); //加入控件 this.pnlCenter.Controls.Add(cform); //让窗体显示 cform.Show(); }