MenuStrip 和 StatusStrip 在 WinForm 的 TabControl 中启动我的应用程序时不起作用



我需要在Winform中的TabControl的选项卡中启动我的应用程序。它可以正常工作,但是当我单击Menustrip项目时,它不会显示子菜单。但是,单击事件工作。此外,我在StatusStrip中使用了一个标签作为按钮,然后单击事件不会开火。

ProcessStartInfo info = new ProcessStartInfo();
info.FileName = MYAPP;
info.Arguments = "/noresize";
info.UseShellExecute = true;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Minimized;
info.RedirectStandardInput = false;
info.RedirectStandardOutput = false;
info.RedirectStandardError = false;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);
p.WaitForInputIdle();
Thread.Sleep(3000);
Process[] p1;

var tp = new TabPage();
tp.Text = Path.GetFileName(file).Replace("Parser-", "").Replace(".exe", "");
tabControl1.TabPages.Add(tp);

if (p.MainWindowHandle == null)
{
    List<String> arrString = new List<String>();
    foreach (Process p2 in Process.GetProcesses())
    {
        // Console.WriteLine(p1.MainWindowHandle);
        arrString.Add(Convert.ToString(p2.ProcessName));
    }
    p1 = Process.GetProcessesByName(Path.GetFileName(file));
    //p.WaitForInputIdle();
    Thread.Sleep(5000);
    SetParent(p1[0].MainWindowHandle, tp.Handle);
    _intPtrs.Add(p1[0].MainWindowHandle);
}
else
{
    SetParent(p.MainWindowHandle, tp.Handle);
    _intPtrs.Add(p.MainWindowHandle);
}

即使我将允许默格特释放为false。我该如何使它起作用?

谢谢。

在这种情况下,我找不到任何解决方案。

对于那些遇到相同问题的人,我已经测试了Devexpress Xtrabars bar,它效果很好!因此,我切换到Devexpress菜单栏。

最新更新