开发者

Keep window in foreground (even if it loses focus)

开发者 https://www.devze.com 2022-12-08 10:53 出处:网络
In my application (C#, Windows Forms) I have got a telephone information screen: if there is an incoming phone call a window with additional information to the caller is shown开发者_StackOverflow.

In my application (C#, Windows Forms) I have got a telephone information screen: if there is an incoming phone call a window with additional information to the caller is shown开发者_StackOverflow.

This window should open in foreground and should stay there even if the user is writing in another window (so the user still sees the information regarding the incoming phone call).

First I've used BringToFront - but this didn't really work in all circumstances (e.g. when the main application was not in the foreground).

Right now I am using BringToFront and the user32.dll function BringWindowToTop -> which works, but if the window loses focus it is in the background.

How do I implement this behaviour ?


I think you want to set your form as TopMost:

yourForm.TopMost = true;
0

精彩评论

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