Is there a way to prevent a Windows Form from disappearing when losing focus? I want my form to stay locked at left of my screen, is there a way?
Asked
Active
Viewed 3,605 times
0
-
2That sounds like horrendous and unbelievably annoying functionality. You're also asking about two different things. – tnw Sep 25 '13 at 16:06
-
2you want to keep application topmost: http://stackoverflow.com/questions/683330/how-to-make-a-window-always-stay-on-top-in-net – Sam Holder Sep 25 '13 at 16:07
-
1You should specify, in your title, tags, and question body, what platform you're using: WinForms, WPF, ASP.NET, etc. C# is a programming language. – Sep 25 '13 at 16:25
2 Answers
1
Try setting
YourForm.Topmost=true;
where YourForm is your form's name.This will make the window topmost.Set this property either using the designer or manually in the Form Load event.
To lock the window at the leftmost side on the screen set its location property as following;
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y);
this makes sure the form remains at the leftmost side even if there are multiple monitors.

devavx
- 1,035
- 9
- 22
0
- Make the form
TopMost
- Set the
StartupPosition
property toManual
- Set both
Left
andTop
properties to0
.
Take a look at this reference too: http://msdn.microsoft.com/en-us/library/52aha046.aspx

Gustavo Gondim
- 1,635
- 2
- 18
- 39
-
-
1@AviralSingh No, unless you consider the location of multiple screens, as you considered in your answer. But the question was considering **a** screen. If the developer has needed to set the position on multiple screens, he would need to specify which screen he wants to set the position before consider the multiple screens coding. – Gustavo Gondim Sep 25 '13 at 16:49