c# taskbar button switching/moving in multiple display environment - c#

I've created a winforms application. All is running fine, also the taskbar button is created and shown in taskbar including the correct icon.
Whenever I move the form from one display to the second display, the taskbar button stays at the display from where the form was initial start.
I also compared the settings with another winforms application where the behaviour is correct. Means, the button is moving/switching/whatever to the active display where the form is moved to.
Hopefully it is just a small thing, but I came not across with it.

It is an OS feature.
For windows 7 there is no built-in support to show taskbar for your second monitor and your taskbar buttons will always show on first monitor taskbar.
For windows 8 you can open Taskbar properties and in Multiple displays settings, check Show taskbar on all displays and then set the value of Show taskbar bottons on: to Taskbar where window is open

Related

Place an application's icon into system tray

I'm making a desktop mascot with unity, and I do not want to see the icon appearing on the task bar, I want the icon in the system tray. Is there a way to do this?
PS: This is NOT a windows form (it's a game), so I believe Form.ShowInTaskbar will not work.
I've never programmed in Unity, but I'm assuming you are working in a Windows window. If you make the top level window for the application not appear in the main area of the Taskbar, make the window a "Tool Window" (by setting the WS_EX_TOOLWINDOW extended style on the window), then the window/app will not show up on the taskbar.
I'll leave it to someone how knows enough Unity to tell you how to set that style. Here's a reference to start with (on the Windows side, not the Unity side): Managing Taskbar Buttons

WPF Menu Popup Placement

I have a UI design that I created to mimic the way that apps in Win10 look but in Win7 - 8. I created a Menu that drops down and has several buttons in it. When this drops down it's the height of the app itself. If the app happens to go behind the task bar the menu drop down opens up instead of down. Is there a way to change this behavior so that no matter where the app is located on a screen it will open down even if that means behind the taskbar.
Thanks

Get state of show desktop toggle

How do I get the state of the Show-Desktop toggle?
Goal:
Show the taskbar when show desktop is toggled and desktop is shown
Hide the taskbar when show desktop is toggled and windows are restore
Problem:
I can toggle show desktop and I can show or hide the taskbar but I cannot find a way to determine the state of the "show desktop" toggle.
I'm working in C# in VS 2010 with .net 2.0 (if it has to have later version .net ok, but I suspect the answer is somewhere in win32 with a pinvoke. Just can't find it)
This app is for a touch screen where getting to a auto-hidden taskbar is nearly impossible. Normally the taskbar is hidden but users would like to get to it when they click show desktop. (i.e. please no non-constructive comments on windows doesn't want you to change the autohide state without user permission)
Semi-Solution that technically meets my project requirements but not the intent of them:
Show the start menu any time show desktop toggles. Of course the start menu disappears when you click anywhere else but... It was shown.
There are several tutorials on how to do this. Just Google

C# TopMost and Tray

I have a WinForms application which shows a new small Form (with TopMost set to true) when a hotkey is pressed.
However when I send my main Form to the tray, the second Form is still displayed on the desktop.
How can I set my Form always to display on top of all applications, or just on top of the currently focused application?
Reference: Form.TopMost.
Form.TopMost will work unless the other program is creating topmost windows. There is no way to create a window that is not covered by new topmost windows of another process.
"How do I create a window that is never covered by any other windows, not even other topmost windows?"
Imagine Ans. if this were possible and imagine if two programs did this. Program A creates a window that is "super-topmost" and so does Program B. Now the user drags the two windows so that they overlap. What happens? You've created yourself a logical impossibility. One of those two windows must be above the other, contradicting the imaginary "super-topmost" feature.

Minimize application just like in Windows 7

How do you make a WPF C# application minimize like Windows 7, when the user presses the minimize button?
Edit
Createde a button that could do this:
WindowState = WindowState.Minimized;
But it minimize instantly and not shrinking to taskbar like when you minimize a folder in windows 7
It will happen by default if you haven't played with the window properties too much in the designer or XAML. So if you haven't changed anything, you don't actually need to do anything to get this to work - assuming you are at least displaying the stuff in a window.
To resize a WPF window in code, please refer to this question:
Minimize a window in WPF?

Categories

Resources