windowstate

C# Will "WindowState.ToString" change between cultures

Take the following code for example; if (Convert.ToString(frm.WindowState) == "Minimized") Layout.WindowState = "Maximized"; else Layout.WindowState = Convert.ToString(frm.WindowState); We are analysing the string definition of the window state, i.e. "Minimized". Would this string description change between cu...

Using C# FormWindowState to restore up?

Hello, I'd like to detect if my application is minimized under certain situations, and if it is, the window needs to be restored. I can do that easily as follows: if(this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; } However, what happens if the user first maximizes the form, then minim...

How can I prevent other apps from stealing the focus?

I have a fullscreen window with the Topmost property set to true. Whenever an application changes its WindowState property, my window is automatically minimized even though it has the active focus. For example, the code below exemplifies the problem. 3 seconds after the window is deactivated, it changes from Minimized to Normal, minimizi...

WPF: Window stays minimized even when setting WindowState explicitly

My application has a tray icon which, when double-clicked, hides or shows the application window. My issue is that I can't seem to bring the window to the foreground if it was in a minimized state when it was hidden. For instance, say the user minimizes the application and then double-clicks the tray icon. The application window is then...

C# - How to change window state of Form, on a different thread?

Hello. Does anyone know how I can chage the window state of a form, from another thread? This is the code I'm using: private void button4_Click(object sender, EventArgs e) { string pathe = label1.Text; string name = Path.GetFileName(pathe); pathe = pathe.Replace(name, ""); string run...

How can I use Window.ShowActivated = false with Maximized window?

I have an application that has a splash screen shown before I create my main window. I want to avoid the main window stealing the focus when it gets created if the user has focused another application while the splash screen was shown. My application's startup looks like this: private void Application_Startup(object sender, StartupEven...

Excel interop: Restore minimized window

In my winforms app interacting with Excel through the com interop, I'm trying to attach to an existing Excel process if there is one. Getting the object seems to work well, but if the Excel application is minimized (which is quite likely in my use case), I don't manage to restore the window and bring it to the front. I've tried the fol...

A program in C# to tell whether opened applications are in maximized mode or not

I would like to know whether any libraries are available in Windows OS which allows us to capture other applications window states ...

How can I make a WPF window maximized on the screen with the mouse cursor?

According to the MSDN documentation for the WindowStartupLocation Property: Setting CenterScreen causes a window to be positioned in the center of the screen that contains the mouse cursor. Although the MSDN doc for the CenterScreen Field itself defines it somewhat less clearly as: The startup location of a window is the center...

Something like RestoreBounds for WindowState

Hi, I have an application that is starting minimized. I can set RestoreBounds to set to which size will the window restore when user restores it. But how can I set if the form should restore to maximized or normal state? Normal is by default. I wish there was something like RestoreWindowState. Can I do this using API somehow? ...