Dialog and toolbox windows re-size themselves to full screen - c#

I'm running a C# .Net program on a computer other than that I developed it on. It works fine, but when you open dialog or toolbox windows within it they always re-size themselves to full screen, which is really annoying as in the code I have set limits on the size and here they are being exceeded. This has never happened before on another PC. It also happens with some other programs, and even a pop-up dialog within Google Chrome.
I think this might be a registry setting but have no idea how to fix this. Has anyone else ever come across this?

Related

How to take a screenshot of a partially hidden window in a programmatic way without brining it to front?

Is it possible to take a screenshot of a partially hidden window without brining it to front? I know this is possible because the Screen Capture API already does this.
https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture
The picture shows the popup when you initiate a capture process. You can see the same popup on Discord or Slack whenever you would like to share your screen. In the popup, you can see the list of the windows that I have open. Some of the windows are partially or completely hidden. However the popup shows the entire contents of them, which is surprising to me. The popup does not show minimized windows, which is fine. This works cross-platform.
I would like to know how the Screen Capture API does this as I have never succeeded in doing so. I personally tried with Win32 + GDI32 APIs but I was unable to take the screenshot of a hidden window. I would prefer a cross-platform solution but for now I am only targeting Windows 10+.
Thank you in advance.
#simon-mourier Thank you for the comment. That was helpful.
https://blogs.windows.com/windowsdeveloper/2019/09/16/new-ways-to-do-screen-capture/
#NothingIsImpossible

Cycle through open windows in C# using ALT+TAB/ESC and have the current window in focus and forced to be maximized (if already minimized to taskbar)?

I am writing a small application to automatically rotate through open windows on Windows 7/8.1/10 PC's. I have written the majority of the code and it is working well except I cannot figure out or find out what key presses to use to cycle through open applications.
I have tried SendKeys.Send("%{Tab 2}"); but this seems to only actually press the TAB button once as it keeps switching between the same two windows (even though more are open).
I have tried SendKeys.Send("%+{Esc}"); but this doesn't maximize windows that are minimized to the taskbar. It will effectively cycle through each open windows and bring them into focus (as evident by watching the white semi-transparent overlay on the taskbar item) but it won't show them on screen - I'm assuming because they started minimized. Only the maximized ones will show on screen when it's their turn.
Can anyone please assist? I'm sure it's a simple fix of maximizing the window it cycles to but I'm unsure how to implement this.
I haven't included the code of the entire application as I don't think it is relevant. If you do require it please let me know and I will add it.
Many thanks.

Winform always stays in front of other applications

I'm having a problem where a winforms application I wrote is always in front of other applications.
Its TopMost property is set to false and yet whenever I click on anything else on my computer (Google Chrome, Windows Explorer, etc) the winforms application stays in front of them, albeit grayed out. This means that to effectively use other applications while my winforms app is running, I have to minimize it.
I'm wondering if there's a way to change it so that it works like a normal application, where it goes behind other windows that are clicked on without minimizing or closing it
Pics:
Upon opening the app
Upon clicking on VS
As you can see, clicking on visual studio does gray out the app, but the app still shows in front of VS. This is the same behavior with all other windows.
Here are the properties of the form:
And the rest of the properties:
Turns out that one of the methods does programmatically change the value of TopMost to true, so that was causing my problem. Thanks to fujiFX for pointing that out as a possible reason

Keep form on desktop at all times (No Win+D effects)

I'm working on a project in which I need a form to stay on the desktop at all times. This would mean that it should still be showing even if a user clicks Win+D to hide/show desktop.
If anyone uses Rainmeter, they will know how meters stay on the desktop despite clicking on the show desktop key.
I really don't mind how to do it, as long as it works. I've looked through hundreds of examples but half of them don't work..
Maybe someone could help me out.
Thanks in advance.
I fired up C# and created a Windows Forms application. I set the forms' TopMost property to True, and its MinimizeBox property to False.
When I run the app, the Window is always on top, even if I use Win+D or click Show Desktop.
I got the idea from here: What is the difference between Minimize All and Show Desktop?
If you want something to stay on the desktop, you should put it on the desktop. Look at using Windows Gadgets which can do what you want.

Setting focus on control causes windows tool bar to appear

When I set focus on a text box, on a forms load event in Windows Mobile 5.0, the Windows tool bar appears even though my form is maximized.
When I do not set the focus on the text box the form opens maximized. I do not want the windows tool bar appearing.
How do I prevent this from happening?
TThe start bar in WinMo is actually not part of your app - it is a separate process managed by the Shell and it really wants to always be on top. Trying to get your app above it goes against the design goals of WinMo (though it's a common thing to want to do).
I'd recommend doing some searching and reading on "kiosk mode" to garner what knowledge you can from others who have been down this road, but what you're seeing is that the StartBar is getting set topmost.
Raffaelle Limosani has a pretty decent blog entry that covers kiosk mode, so it's a good place to start (take a look at the other blogs he links to as well).
The toolbar at the top is actually a separate window, and it has a habit of appearing when not wanted over top of a full-screen ("kiosk" mode) app. For example, if you ShowDialog a second full-screen window from the first, the Start window flickers up for a split second before going away.
The only way I ever found of dealing with it was to hack into the API and actually make the Start window hidden while my application was open. This is a big potential problem, because if your app crashes without making the Start window visible again, it will stay invisible until you reset the device (or run you app again successfully).
I'd advice against doing this unless you absolutely have to. As ctacke points out, this would be an example of an app not playing nicely with Windows Mobile.

Categories

Resources