Keyboard shortcuts not working when adding a form to a C # panel
I am writing an application where I have a form with a panel. I noticed that when I add another form to the panel, the hotkeys of the added form stop working.
I am using the following code:
MainMenu m = new MainMenu();
m.TopLevel = false;
m.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
m.Dock = System.Windows.Forms.DockStyle.Fill;
pnl.Controls.Add(m);
m.Visible = true;
pnl.ResumeLayout();
Is there anyway to work with keyboard shortcuts?
Hello
0
a source to share
3 answers
My first guess (and this is entirely a guess) is that you need to pass the parent / owner when creating the child, not just assign the parent ... could you show us this part of your code?
Also, just by looking at your code, it seems strange, for MainMenu, set the Dock to fill ....
+1
a source to share