How to show the form with the desktop background dimmed? [duplicate] - c#

This question already has an answer here:
C# Best Method to Dim Screen, Multiple Windows Forms?
(1 answer)
Closed 9 years ago.
I want to show the winform to be displayed, however the form would be in the normal state (not maximized). However, i want to dim the desktop background to be dimmed for user attention.
Maximized form with background dimmed is an option, but i don't want to maximize the form.

Maximized form with background dimmed is an option
Firstly if the form is maximised, then there is no point in doing anything with the background as it cannot be seen.
i want to dim the desktop background to be dimmed for user attention
This is messing with the OS settings, and I am not even sure if it is possible and it is certainly not desirable. I, as a user, would never want an application messing with my other running programs or my OS settings/preferences.
In short what you want is not possible (at least with out some nasty code) and it is not good practice.

I dont think you can change the background, as well as I dont think you should.
I'd try to open "maximized" form with large opaque (or half-transparent) border.
May be this will be helpful

Related

Change application name shown in Windows 10 taskbar [duplicate]

I develop with VS2010 in C# and I would like to create a WPF Window which have a taskbar text different from the Window title.
The property Title set both the window title and the taskbar text. Is there a way to set them separatly?
First, let me reinforce what Cody Gray said in both his answer and comment - this is non-standard behavior, and you should have a darn good reason for doing this.
That being said, I would take a nearly opposite approach to Cody's point #1. I would create a window WindowStyle set to None, and recreate the title bar (which could include the icon, your "pseudo-title," minimize, maximize, and close buttons, and perhaps even the standard Windows menu. You will also need to handle resizing (which can be done by setting ResizeMode to CanResizeWithGrip, but it adds a Grip control to the bottom of your window, which makes it look slightly different than a "normal" window).
The Title property of this window would then be the Title you want to show in the Taskbar, and the "pseudo-title" in the title bar you create would just be a Label or TextBlock bound to whatever you want your window to show.
It is a little complex, but really not too difficult to do. You will probably run into some Gotchas along the way (for instance, how the Window looks on different OS's or with different Windows themes applied). The nice thing is that it requires no Interop, and a majority of it can be attained using XAML only.
There are lots of examples online (here is one I picked at random).
Again, you'll have to decide if it is worth the effort to create a non-standard behavior. YMMV.
Basically, you have two options:
Draw the taskbar button yourself, rather than letting Windows handle it. This is actually reasonably simple, as far as owner drawing things goes.
Manage two different forms/windows simultaneously. You'll need to create a hidden main window that will appear on the taskbar and own your second window. Your second window will be visible, display its own caption on its title bar, and contain your actual user interface, but won't show up on the taskbar (set its ShowInTaskbar property to "False"). You'll have to write code to show the second window whenever the first one is activated using the taskbar.
I recommend that before starting down either one of these paths, you carefully consider whether you really need this "functionality". It's difficult to tell what goes with what if you have what is effectively one window with different names in different places.
try to use this:
http://www.codeguru.com/forum/showthread.php?t=3833
in conjunction with
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6b97a6de-0480-4339-8ed0-cb7cdb27bd83
The first one works fine for me in classical .NET form application when I have made window without title bar and want some text in task bar icon.
The second one you need to handle low level WIN32 messages in WPF window (but this works only for top level one).

How to make win form application responsive? [duplicate]

This question already has answers here:
How to make the UI responsive in Winforms [closed]
(2 answers)
Closed 4 years ago.
We have developed POS system using windows application ,but there is a requirement to make it responsive ,which is not possible.
We have tried to use Flow panel but 100% responsive not done.
we have another option to convert it into WPF but it will require more time.
any one have suggestion to make windows form application which adjust according to screen resolution.
You can evaluate TableLayoutPanel and ensure that columns and rows are defined as percentage instead of absolute values. You would also need to work out docking and anchoring for individual controls.
If you are looking for layout to switch from, say, horizontal to vertical, then you will need to work with resizing event of the form.
Pretty much, you can't make a WinForms app respond well to different resolutions: it's possible, but it's a heavy amount of work and probably won't be too wonderful when you are finished.
The problem is that although all controls can be Anchored and Docked so they resize automatically, that doesn't have any effect on text within the controls: so you end up with a large button with tiny unreadable text in the middle, or a tiny button with huge unreadable text in the middle.
While it's possible to get round this by handling the Resize event for each control and working out what font size to use based on the new display area, that's not trivial and generally takes a fair amount of trial and error, plus the odd "fudge factor" thrown in to deal with strange cases.
You can do it, but it's serious work - WPF handles it a lot better!
The other solution is to redesign your UI to work well at multiple resolutions in the same way tat Visual Studio does: a central "work space" with all the tools in panels which float or dock round the edges. But for a POS system, that probably isn't practical!

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.

Different Application Size On Different Screens [duplicate]

This question already has answers here:
.Net controls changing size between computers
(3 answers)
Closed 9 years ago.
First time i'm developing a Windows Form Application with C# . I'm using Visual Studio 2012.
My form's size = 1096x508. Also i set Minimum Size and Maximum Size properties to 1096x508 .
This is screenshot of my app ,
But when i execute this app on another computer, result like this :
As you see, red line (at bottom of app) invisible. Because applciation's height is 508 px (as expected) on my pc but 416px on other computer. Because of this , red line staying out of Form. So we couldn't see it.
In shortly, my Form's size 1096x508px but it's only 823x416px on another computer. Can you tell me why there are difference? And how can i fix this? There are resolution difference between this screens.
The behaviour of your application on those computers may be caused by different dpi (dot-per-inch) settings of the Windows operating system. In order to check that please compare the actuals values in Windows display settings (100%, 125%, ...).
If you want to have your program independent from dpi settings you may try to work with different panels (control containers). Your status bar could have a fixed with, while the game area is a docked panel (filling the remaining space).
In general, staying independent from actual dpi, is a difficult topic. Most of the time you can work with autosizing controls, but you could run out of space if, say, two labels overlay.
The main issue, as you have already discovered, is that computers with a different DPI setting will cause the controls to scale.
What Hans was suggesting in his linked answer is that you need to re-design your form so when it gets re-size messages it will handle them accordingly.
The main way this is normally handled is setting the Anchor property or the Dock property of a control. By default a control will anchor to the top left corner of it's parent container. When it is told to scale it scales down and to the right. By changing the anchor point to be the bottom only it will make your bottom control move up instead of moving down off of the boundaries of the parent.

Disable resizing out of browser Silverlight 4 Window [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I prevent the user from resizing the silverlight out-of-browser window?
Is there any way to actually remove the ability to maximize/resize the out of browser window since I want my application to be of a certain size.
Thanks
I can't be 100% sure but I would hazard a guess you could just go:
this.resizable = false;
this.maximise = FALSE;
in the constructor of the views code behind file.
You can make any new window have no statusbar, no toolbar, no resize, etc. using window.open():
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml
However, this is completely dependent on the browser, many ignore this, or have a user setting to override this behavior.

Categories

Resources