WPF : Application Toolbar - c#

I would like to make a login screen for my WPF application, but I want this login screen to be constantly available at a corner of the screen like an application toolbar the application should be hidden and only display when the mouse hovers over a part of the toolbar.
I have searched for solutions, but the only ones I have seen were implemented in c++ for windows applications.

Standard caveats about "always available" apply here of course.
That said, you could easily create a window with WindowStyle="None" (MSDN) and position it wherever you want. This eliminates all window chrome, making it appear that the content is just sitting on the screen. By handling the MouseOver event you could expand to show your additional controls.
Other tricks can be used to have the application live in the tray, etc. For example:
Minimizing Application to system tray using WPF ( Not using NotifyIcon )

Related

C# WPF Overlay for fullscreen applications?

I'm making an app that displays what keys you are pressing, and I was wondering if there was a way to overlay some image widgets on top of the screen so that they stay on top even when you are in full screen mode. I'm using WPF with Visual Studio. A link to a tutorial or a download to an example would help a ton!
You haven't clarified whether you want the widgets to appear over top of all windows, or just your WPF one.
If you want it to appear over just your window then look into use an adorner.
If you want it to appear over all windows then use this WindowSinker class which intercepts the WM_SETFOCUS message for your window and calls SetWindowPos to set the HWND_TOPMOST flag.

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

Create a WPF Window that captures AND passes through Mouse Events

I'm working on a screen capture utility that captures active windows. I'm using transparent overlays to capture the full screen and then overlay the active windows based on mouse move events passed through to the underlying desktop/windows.
Both of the overlay windows currently use the WS_EX_TRANSPARENT style to allow mouse events to pass through to the underlying windows so I can detect where the mouse cursor is located. I grab the window handle and rect size to outline the window and then use Global Mouse and Keyboard Hooks to accept or reject a capture.
It's pretty ugly and spread out code (which is why I'm not posting here for now) but it all works very well and I can highlight the windows in mousemove and capture clicks with the global mouse and key handlers.
It all works except for this problem:
The Global Windows Hooks do not fire over an Admin Window so when I want to capture a Powershell, Command or Visual Studio (in Admin mode) Window no hook events are forwarded.
Apparently there's no way to work around this security issues using Windows hooks (or GetAsyncKeystate() for that matter).
I've tried a couple of different approaches to work around this issue:
Instead of using Hooks I tried using the highlight window to capture mouse/key events
This sort of works, but it's clumsy - fails if no window is selected at all (no way to get out) and doesn't allow for selecting contained windows once the parent is selected (ie. no drill down)
I also tried Win32 GetAsyncKeystate() which captures the last mouse or keyboard input and that would work, but it too fails to send mouse or key interactions from Admin windows.
So I have two choices imperfect solutions at the moment: using Hooks or GetAsyncKeyState to get the proper Window browsing selection behavior for all but admin windows, or I can capture all windows but lose the ability to drill into child windows after a parent window is selected.
I'm at the end of my rope and the real question is this:
Is there some way to create a semi-transparent or transparent window that can intercept mouseclicks and pass them on to the window area below?

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

How can I be notified when Windows XP fades the screen to gray?

We have an application developed in C# with WPF (.NET Framework 3.0)
The main window has a glass border, and a child window containing a WebBrowser is centered within it:
WPF main window
-> Child window - frame control
-> Page
-> WindowsFormsHost
-> WebBrowser
Because we used .NET 3.0, we have to put WebBrowser in WindowsFormsHost, and it can't show if we set the window property AllowTransparency to true.
Now, on Windows XP, when the user clicks the Shutdown button on the Start menu, a dialog is displayed with various choices (shutdown, restart, etc.) while behind it the entire desktop appears to fade from color to shades of gray. When this occurs, our main window becomes hidden, while the page window is still displayed on the screen.
We have already set page window's owner to be the main window, but this did not help. Therefore, I have come to the conclusion that I must intercept the "fade to gray" event and... do something to mitigate this ugliness. So: does anyone know how I might allow my program to be notified prior to the fade to gray?
As I know there is no way to be notified when Windows fades the screen to gray.
System.SystemEvents class doesn't have such an event either.

Categories

Resources