Set Window almost Topmost - c#

I code an editor, that should have a fullscreen-mode (editor covers 100% of the screen, taskbar is not visible). "Set the Window Topmost" you would say, but hereĀ“s the problem: my editor runs external programs, that have to be visible.
My editor should hide the taskbar, but not be topmost for other applications. Is this possible? And how?

You don't need a TopMost window to cover the taskbar. Creating a borderless maximized window is enough:
public MainWindow() {
InitializeComponent();
this.WindowState = System.Windows.WindowState.Maximized;
this.ResizeMode = System.Windows.ResizeMode.NoResize;
}
You still need a way for the user to activate a window of another application. It isn't clear what you had in mind, but Alt+Tab works.

Related

Show icon in taskbar for hidden windows

When I set the main window's visibility to hidden, No icon is shown in taskbar, so I have no control over the window to show it again. I want for the application's icon to be visible even when I hide the window, and to show the window when I click it's button in the taskbar. (something like minimize behavior)
How can I achieve that using WPF and .Net 4.0 in C#?
Edit: I mean the icon in taskbar (usually in the left and middle of the horizontal taskbar) not the notifyicon in system tray.
So, based on "comments" section, what you are looking to do is minimize or hide a window but still show some windows or dialogues that the window opens. First if you want to keep your window in the task bar, you should minimize with:
this.WindowState = WindowState.Minimized
That can be called from anywhere within the form. As you mentioned, though, this will close hide any dialogues that have this window set as the parent. The key, then is to not use this window as the parent. Lets say your dialogues inherit from form. You want to use:
newWindow.Show();
I am guessing that you are calling "ShowDialog", which ties the window state to the parent window state. Try this out and hopefully it will help!
Edit
One more note: the same is actually true of MessageBoxes, but the way to control the parent form is with the first parameter of the MessageBox.Show() call. If you pass in a form as the first parameter, that will be the parent, otherwise the parent will not be set.

Completely Maximize C# winform and hiding open window icons at bottom

I already set this.WindowState = FormWindowState.Maximized; and everything looks ok but the Windows open-window icons (such as my browser at the bottom of the page) is still visible.
How to make it invisible?
I just figured out the answer
TopMost must be set to true together with FormBorderStyle = FormBorderStyle.None and Bounds = Screen.PrimaryScreen.Bounds.

Irregualr behaviour with windows taskbar when making my application 'full screen' (WPF)

I am working on an application that has a full screen mode. When the full screen button/key is pressed the application should take up the entire screen i.e. the windows taskbar also disappears.
this.Window= WindowState.Maximized;
this.Window= WindowStyle.None;
this.Fullscreen = true;
When I first start the application my fullscreen mode works as planned and the windows taskbar disappears. The problem is when I resize the window. After any resizing the full screen mode no longer takes up the entire screen. The windows taskbar is still there. It is not reasonable for me to disable window resizing (although that does solve the problem).
It was my understanding that WindowStyle.None removed the taskbar (it does at first). Does anyone know if resizing the window changes something that stops the WindowStyle.None from doing what it does upon first starting up.
EDIT:
I am using a viewbox to scale my content to fullscreen and the stretch of the viewbox in full screen mode is set to Fill
Try applying the WindowStyle first (before WindowState). That fixed it for me.
Edit: I also noticed that this doesn't work when the window is already maximized. Try this:
this.WindowState = WindowState.Normal;
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;
Instead of using WindowState
use SystemParameters
In your Window's constructor set the width and height
this.Width=SystemParameters.FullPrimaryScreenWidth;
this.Height=SystemParameters.FullPrimaryScreenHeight;
You can also have a look here

C# Fullscreen, hiding the taskbar

I have recently written an application for my daughter, which is a kid-free zone where she has all unnecessary key presses ignored (windows key, Esc etc) but the problem I am having is that when I use the following code:
targetForm.WindowState = FormWindowState.Maximized;
targetForm.FormBorderStyle = FormBorderStyle.None;
targetForm.TopMost = true;
I am able to HIDE the taskbar, but it is not truly overlayed. When I move the mouse to where the taskbar would be, and click, it pops up, also, using this code and running external applications withing my windows form, I am left with this windows form keeping itself on top.
If anyone could help me with a proper way to display my windows form as a true fullscreen application, and be able to run external applications from within the form and have them prioritize themselves on top, that would be greatly appreciated.
In case you missed it, I am using VS2010, C# and winforms.
Thanks in advance!
The proper way to make a full-screen app is to just put something like Bounds = Screen.PrimaryScreen.Bounds; in your main form. Then when your app has focus it will cover the task bar.
You also probably want FormBorderStyle = FormBorderStyle.None;
The order of the performed actions is incorrect.
You should first hide the border (FormBorderStyle=None), and then set the window state to maximized. You even don't have to set TopMost to true.

Get rid of XAML Window from Taskbar

If I have a XAML window that I show with ShowDialog, is there a way to make it (not) appear in the taskbar?
The problem is that I can set the window to be topmost but if that window opens another dialog and I set that also to be topmost, I can put the second behind the first by clicking in the taskbar. This tends to confuse users.
In your child window, set the ShowInTaskbar property to false.

Categories