C# MDI Parent Gain Focus by clicking on MDI Parent background
I want to set focus to an MDI Parent Form when I click on the background of the form. However, the only way I can get it to set focus is when I resize the form.
I have tried using mouse click event, click event, key press event etc to manually set the focus when you click on t开发者_运维知识库he MDI Parent but none of these events fire. Is there ANY way to set the focus to the MDI Parent when you click on the background of the form?
That background is a separate control, try to find it in MainForm.Controls and assign it's click event.
You may want to look at the Win32 WM_MDIACTIVATE message. Now that we've discussed a possible solution, the real question can begin:
I think you should look long and hard at what your trying to accomplish. You risk (not necessarily will, but risk) creating a behavior that is abnormal and confusing to users. Why do you want to move the focus? What will you once it gets moved? How will you indicate to the user that this has been done? How will then get out of this state?
精彩评论