public reportView(editpro.editType mType, string proID) { //如果这里不现初始化控件而直接使用,则会导致空指针问题 InitializeComponent(); //先设置proID,否则设置mType时没有proID this.proID = proID; this.mType = mType; //这一步使用了控件,所以必须先初始化控件 }
/// <summary> /// 构造chartView /// </summary> /// <param name="mType">要绘制的监测类型</param> /// <param name="proID">项目ID</param> public chartView(editpro.editType mType, string proID) { //先初始化控件 InitializeComponent(); this.proID = proID; //设置mType时读取数据并显示 this.mType = mType; }
private void lv_fp_pros_MouseDoubleClick(object sender, MouseEventArgs e) { ListView.SelectedListViewItemCollection slvic = lv_fp_pros.SelectedItems; if (slvic[0].Name == "newPro") { Addpro(); } else //打开编辑项目窗口 { editpro ep = new editpro(slvic[0].Name, slvic[0].Text); ep.delPro += 删除ToolStripMenuItem_Click; ep.Show(); } }