开发者

How to Activite form when clicked anywhere on the form?

MY C# app workd fine and stays on top whenever asked to. What I face 开发者_如何学Cand want is :

Suppose my app is open and another app (say Notepad) is also opened halfly overlapping my app window. When we click anywhere on Notepad, it gets activated. Whereas with my app, I got to click the top bar of the window to make it active. Why so ? I want to make my app active and bring to front when user clicks anywhere on the form and not just hte top bar.

What do I need to set or implement to accomplish this ?


Try to do that ,on Form1_MousClick Event put this Code

bool top = this.TopMost;
this.TopMost = true;
this.TopMost = top;


Nothing, if you click anywhere on a Window, it gets focus and becomes the topmost window, unless another window is 'Always on top'.


The problem was with overridding WndProc. One unnecessary statement was removed and things got solved out.Thanks to all of you for your efforts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜