Question

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.

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 ?

Was it helpful?

Solution

I think you want to set your form as TopMost:

yourForm.TopMost = true;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top