C# WPF Overlay for fullscreen applications? - c#

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.

Related

WPF : Application Toolbar

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 )

C# Desktop App Bar (Somewhat Like a taskbar)

I've been googling a lot for this one and I can't seem to find anything. Maybe it's the way that I'm wording it. So basically what I'm looking to do in C# using Windows Forms, is create a form and have it essentially take the shape of the taskbar and do the same functions as the taskbar, but it will sit above the task bar or at the top of the screen.
It can't be "ON TOP" (I'm not trying to block user buttons like the close button of a program they are using).
Autohide would be a plus.
This is the main thing I'm after:
It needs to act just like the task bar. When you maximize any other window, the taskbar does not go over the top of the window, even though it is set to "on top".
You'll want to use an Appbar to do this:
http://msdn.microsoft.com/en-us/library/cc144177.aspx
For more information, check out here and here and here.
If you don't want to deal with C++ and Native Code (as #FKunecke correctly proposed) then you'll not find anything predefined for this. What you can do is create a form for your bar and make the visualization calculations by hand, then you can set the screen location of it. That's all. Not forcing the bar form to stay on top will not hide the other app forms so you'll get that for free.
Now, to fully implement what you want there are some problems you need to deal with, such as Taskbar location and height. Then you'll need to use some native code tricks.

Changing taskbar button color on Windows

Multiple instances of the same application are running at the same time, and since each has multiple windows, it is not easy for the user to navigate between them. I help users by setting the titlebar color of different application instances to a different value. For example, all windows of the app instance started first will have red titlebar, all windows of the second instance will have a green one, etc.
It would also be useful to set the taskbar button color of app instances to the color I use for the titlebar. Is this possible? If not then I would be happy with a solution having similar differentiating effect, like setting the color of the text on the taskbar button, adding an overlay icon to it, etc.
The solution should work on Windows XP and later Windows versions. The language can be C/C++, C# or Delphi. Thank you very much in advance!
You cannot hope to achieve differently coloured taskbar buttons.
You could install your own shell and take complete control of the taskbar, but you can't expect your clients to do that.
You cannot expect to paint over the top of the Windows taskbar. The taskbar is animated. How are you going to keep up with that? How are you going to even know where the buttons are? I don't believe that there is a public API that will tell you that. I think you have to rule that idea out.
There is an API that allows you to change the colour of a taskbar button. It's the taskbar progress API added in Windows 7. You could use that to make your taskbar buttons yellow, green or red. I personally would not recommend that since the user will think you are showing progress.
The main options that are available to you are to change the window caption, and so the text that appears in the taskbar button. Or to change the icon.

Own form border style

I always thought that form borders that use programs like iTunes or Visual Studio 2012 are done without border style and buttons as close button are drawn as images.
However once my Visual Studio wasn't responding and the border changed to the basic Windows border.
How can I get own form border? Is it possible in C#?
You are seeing the "ghost window", a window that the Windows window manager creates to replace the dead window. You see "Not Responding" in the title bar. That window isn't going to have to same custom styling of course, there's no way Windows knows how to do that properly.
You can use the Spy++ utility to look at the window properties of another app. VS2012 does in fact use a regular window style with a title bar. How they customized it is a well kept secret, I suspect they intercept WM_NCPAINT, a fairly difficult message to implement yourself. Using a borderless window is definitely easier.
Further to #Hans' post:
Using WPF you can set the windowstyle to none like this:
<Window WindowStyle="None">
Then you can implement your own buttons.

Non client painting on aero glass window

Now Im customizing title bar of my application. My aim is to add one extra button on title bar. Im my previous question people have adviced me the way I can customize non client area. Thats works perfectly except one small thing - glowing! I can draw glowing in nonclient area but I cannot make it spreads out of the window. I also cant find any resource about this subj.
I looked into this sample and made my own test app for investigating non client drawing facilities. Screen shot of my app's window:
So you can see that system button glows out of the windows when my is clipped by borderframe.
For example, Skype's window have four custom buttons in title bar and they can "glow" out of the window frame:
Can anybody advise me to find out the way to draw button's glowing out of the window?
Thanks in advance!
[EDIT]
Thank you everybody for answers!
Skype cheats it, and has a little sliver along the top of their window; where they can draw it.
You can see it with Process Explorer to SpyXX:
See also
MSDN: Custom Window Frame Using DWM
I don't think it's possible to draw beyond your NC area, and I kind of doubt they are drawing the whole UI to exactly match DWM Aero effects.
Given how this looks, I wonder if they did some tricks with either the help or restore button of a CustomBorderForm, which would then get the DWM blur highlight effect "for free".
Here's the most relevant article I could find to this: http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx
Followup - I think this custom chrome thread has more pointers to the same techniques (although different goal): Custom titlebars/chrome in a WinForms app
AFAIK, this is not possible, because the area outside your window's border simply does not belong to you.
The Skype screenshot is from a custom-drawn frame that most likely extends a bit beyond the visible borders, not from an Aero Glass frame. You can tell the difference if you look carefully.

Categories

Resources