[英]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.