附图
如下是我做的TEST 程序,我想通过点击程序ID "w_tst307",弹出如图w_tst307程序
说明: CopyERP为Mdiparent ,pgMenu和 W_TST307都是普通窗口,
我想实现的是,在点击如图--1--的时候,弹出 --2 --来,并且w_tst307为CopyERP的子窗口
如代码:
需要帮助的位置在黄底红字那里
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CopyERP
{
public partial class PgMenu : Form
{
public PgMenu()
{
InitializeComponent();
}
//-------------------------------------------------------------------------
//判断Child WD 是否已经打开
//-------------------------------------------------------------------------
private bool checkChildFrmExist(string childFrmName)
{
foreach (Form
childFrm
in this.MdiParent.MdiChildren)
{
if (childFrm.Name == childFrmName) //用子窗体的Name进行判断,如果存在则将他激活
{
if (childFrm.WindowState == FormWindowState.Minimized)
{
childFrm.WindowState = FormWindowState.Normal;
}
childFrm.Activate();
return true;
}
}
return false;
}
//-------------------------------------------------------------------------
//PgMenu_Load载入,项目载入节点
//-------------------------------------------------------------------------
private void PgMenu_Load(object sender, EventArgs e)
{
DataRow myRow;
// TODO: 这行代码将数据加载到表“dS_Load.sy010m”中。您可以根据需要移动或移除它。
this.sy010mTableAdapter.Fill(this.dS_Load.sy010m);
for (int i = 0; i < dS_Load.Tables["sy010m"].Rows.Count; i++)
{
myRow = dS_Load.Tables["sy010m"].Rows[i];
string ls_module = myRow[0].ToString().Trim();
string ls_module_f = myRow[0].ToString().Trim().Substring(0, 4);
string ls_module_l;
string ls_module_t;
string ls_nm_cha = myRow[3].ToString().Trim();
if (ls_module.Substring(4, 4) == "0000")
{
TreeNode tn_1 = new TreeNode();
tn_1.Name = ls_module;
tn_1.Text = ls_nm_cha;
treeView1.Nodes.Add(tn_1);
}
//if
else
{
for (int j = 0; j < treeView1.Nodes.Count; j++)
{
//MessageBox.Show(treeView1.Nodes[j].Name.ToString());
ls_module_t = treeView1.Nodes[j].Name.ToString().Substring(0, 4);
ls_module_l = treeView1.Nodes[j].Name.ToString().Substring(4, 4);
if (ls_module_f == ls_module_t && ls_module_l == "0000")
{
TreeNode tn_2 = new TreeNode();
tn_2.Name = ls_module;
tn_2.Text = ls_nm_cha;
treeView1.Nodes[j].Nodes.Add(tn_2);
}
}
//for
}
//else
}
//for
}
//-------------------------------------------------------------------------
//查询节点下的程序目录
//-------------------------------------------------------------------------
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
string ls_name;
ls_name = treeView1.SelectedNode.Name;
this.sy020mTableAdapter.Fill(this.dS_Load.sy020m, ls_name);
}
//-------------------------------------------------------------------------
//双击Dgv_menu 程序项目事件
//-------------------------------------------------------------------------
private void dgv_menu_CellDClick(object sender, DataGridViewCellEventArgs e)
{
string ls_pgid;
ls_pgid = this.dgv_menu.CurrentRow.Cells[0].Value.ToString().Trim();
//如何通过ls_pgid 来打开我想的那个程序,帮帮我
//
}
//-------------------------------------------------------------------------
}
}