gpt4 book ai didi

c# - 从子窗体设置 MdiParent

转载 作者:行者123 更新时间:2023-12-02 22:23:10 25 4
gpt4 key购买 nike

我有一个主窗体,其中包含一个用于打开子窗体的菜单:

public Le_MainForm()
{
InitializeComponent();
this.IsMdiContainer = true;
.....
}

private void barButtonItem_CreatOrdreAller_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Close_AllForm();
Program.StatusOrdre = 1;
Program.AllerRetour = "Ordre Aller";
Fiche_Ordre f_Fiche = new Fiche_Ordre();
f_Fiche.MdiParent = this;
f_Fiche.Show();
}

它运行良好,但我从 child 那里打开另一个表格,我丢失了 MdiParent:

public Liste_Ordres()
{
InitializeComponent();
....
}

private void Liste_DobleClic(object sender, EventArgs e)
{
Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
f_Fiche.ShowDialog();
}

最佳答案

尝试像这样设置表单:

Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
f_Fiche.MdiParent = this.MdiParent;
f_Fiche.Show();

ShowDialog() 用于弹出模式窗体。

关于c# - 从子窗体设置 MdiParent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13382747/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com