本文介绍了显示已打开的表单mp_predracun C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 表格的名称是mp_predracun 如果打开show mp_predracun,否则打开新的mp_predracun 我尝试了什么: privatevoidPredračunToolStripMenuItem_Click(object sender,EventArgs e) { mp_predracun newMDIChild = new mp_predracun(); newMDIChild.MdiParent = this; newMDIChild.Show(); } 解决方案 怎么样...... static mp_predracun FormToOpen = null ; private void PredračunToolStripMenuItem_Click(对象 sender,EventArgs e) { if (FormToOpen == null ) // 第一次在 { FormToOpen = new mp_predracun(); FormToOpen.MdiParent = 此; } FormToOpen.Show(); // 显示已保存/新创建的表单 } 或更钝但更短... static mp_predracun FormToOpen = 空; private void PredračunToolStripMenuItem_Click(对象 sender,EventArgs e) { FormToOpen = FormToOpen == null ? new mp_predracun():FormToOpen; FormToOpen.MdiParent = 此; FormToOpen.Show(); // 显示已保存/新创建的表单 } name of form is mp_predracunIf opened show mp_predracun, else open new mp_predracunWhat I have tried:private void PredračunToolStripMenuItem_Click(object sender, EventArgs e) { mp_predracun newMDIChild = new mp_predracun(); newMDIChild.MdiParent = this; newMDIChild.Show(); } 解决方案 How about something like ...static mp_predracun FormToOpen = null;private void PredračunToolStripMenuItem_Click(object sender, EventArgs e) { if (FormToOpen == null) // First time in { FormToOpen = new mp_predracun(); FormToOpen.MdiParent = this; } FormToOpen.Show(); // Show the saved / newly created form }or, more obtuse but shorter ...static mp_predracun FormToOpen = null;private void PredračunToolStripMenuItem_Click(object sender, EventArgs e) { FormToOpen = FormToOpen == null ? new mp_predracun() : FormToOpen; FormToOpen.MdiParent = this; FormToOpen.Show(); // Show the saved / newly created form } 这篇关于显示已打开的表单mp_predracun C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 20:01