[英]MenuStrip and StatusStrip doesn't work when Launch my app inside a TabControl in a WinForm
我需要在WinForm中的TabControl的TabPage中启动我的应用程序。 它工作正常,但是当我单击MenuStrip项时,它不显示子菜单。 但是Click事件有效。此外,我在StatusStrip中使用标签作为按钮,但Click事件不会触发。
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);
}
甚至我将AllowMerge设置为False。 我该如何运作?
谢谢。
在这种情况下,我找不到任何使.Net MenuStrip工作的解决方案。
对于那些有相同问题的人,我已经测试过DevExpress XtraBars Bar,它很棒! 所以我切换到DevExpress菜单栏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.