multiple-monitors

How to make a dialog(view) open up on the same monitor as the main window

柔情痞子 提交于 2019-12-01 18:44:40
In a PC with multiple monitors, say you run your application which have have a second Window/Dialog other than the main window (such as Options) that you want it to open in the same screen/monitor as your MainWindow . How to force this behavior? You basically want to stop the scenario that your MainWindow is on one monitor and when you bring up the "Options" page, it shows on a different screen/monitor. Have you looked at the WindowStartupLocation property for Window ? CenterScreen places the Window in the center of the screen containing the cursor, which should normally be fine. For example,

How to disable a secondary monitor (with ChangeDisplaySettingsEx)?

ε祈祈猫儿з 提交于 2019-12-01 17:28:53
I'm trying to follow the instructions on MSDN given here to disable a secondary monitor. I'm trying to use specifically this set of functions to allow compatibility with older versions of Windows. However, I can't manage to disable a monitor. I'm running and testing this on Windows 7 x64. All I get is a flickering screen. The code definitely detects the monitor properly - I managed to change resolution and view it's display modes easily. Here are (parts) of my code - I tried a lot of variations on the fields for DEVMODE DEVMODE deleteScreenMode; ZeroMemory(&deleteScreenMode, sizeof(DEVMODE));

.NET thinks screens are ordered differently than Windows Control Panel | Display | Screen Resolution does

旧巷老猫 提交于 2019-12-01 11:47:09
Weird thing I saw last night on a PC running Windows 7 Embedded Standard 64-bit with 2 monitors connected. The Display Resolution dialog shows the monitors as being display 1 and display 2 (from left to right). When I run a program I wrote that used both screens, the output I expected on display 1 showed up on the rightmost display, and the output I expected on display 2 showed up on the leftmost display. Spent some time here and on Google, and ended up using some code I found to create a console app that displayed the contents of the System.Windows.Forms.Screen.AllScreens: // For each screen,

.NET thinks screens are ordered differently than Windows Control Panel | Display | Screen Resolution does

大兔子大兔子 提交于 2019-12-01 08:33:24
问题 Weird thing I saw last night on a PC running Windows 7 Embedded Standard 64-bit with 2 monitors connected. The Display Resolution dialog shows the monitors as being display 1 and display 2 (from left to right). When I run a program I wrote that used both screens, the output I expected on display 1 showed up on the rightmost display, and the output I expected on display 2 showed up on the leftmost display. Spent some time here and on Google, and ended up using some code I found to create a

How to recognize when number, position, or resolution of monitors has changed? [duplicate]

微笑、不失礼 提交于 2019-12-01 08:18:27
This question already has an answer here: How to detect screen resolution change in Delphi? 1 answer I'm building something which needs to detect when things change with the monitor configuration. This includes Monitor added/removed, Monitor position moved (compared to main screen), or when Monitor resolution has changed. The most ideal way would be catching some windows messages, if any, which are triggered when such events occur. This information will be used to keep a real-time record of the monitor sizes/positions at any given time. For example, when a monitor's resolution is increased, my

How to change 3rd monitor programmatically

痴心易碎 提交于 2019-12-01 07:17:22
When I'm using my laptop, I use 3 displays: The laptop display A second monitor (connected through VGA) A TV (connected through HDMI) My videocard doesn't support 3 monitors, so I'm constantly switching from 2 to 3: when I'm on the computer, I use the 2nd monitor, and when I want to watch some movies, etc. I use the 3rd. I currently have to go to Screen Resolution , select the monitor that is not in use, and choose Extend desktop to this display . Is there a way I can automate it? Is there any command-line tool, or any Windows API that allows doing it? Edit: Display Changer seems to do what I

C# selectively turn off monitor

元气小坏坏 提交于 2019-12-01 05:34:21
问题 is there a way in C# to identify all monitors connected to the system and choose which ones to turn on, off or low power? The previous questions i found on SO just turn off all monitors. 回答1: Can you use http://pinvoke.net/default.aspx/user32.EnumDisplayMonitors? Seems like once you get the handle then you can use PInvoke like it's used in the replies to the following question... Turn on/off monitor 来源: https://stackoverflow.com/questions/3705019/c-sharp-selectively-turn-off-monitor

Launch an application and send it to second monitor

有些话、适合烂在心里 提交于 2019-11-30 23:41:57
In VB 2008, I am using the class 'process' to launch and external application with a few parameters. Does anybody knows how can I send it programmatically to second monitor? Also, is there any way to know how many monitors are activated? Thanks. You can locate your form on a different screen. form.Location = Screen.AllScreens(1).Bounds.Location + new Point(100, 100) When you launch an application, use the Process Handle to get the Window (hWnd). It's this hWnd value that windows API uses. You will need to use the SetWindowRect method imported from User32.dll (see last link) See also Screen

Is there any way to stop a WPF Popup from repositioning itself when it goes off-screen?

回眸只為那壹抹淺笑 提交于 2019-11-30 18:33:24
Is there any way to stop a WPF Popup from repositioning itself when it goes off-screen? I found this old question , but it didn't get a proper answer to it. Is there any way to do this? I'm willing to subclass it if necessary. Thanks. As Andrei points out, this behavior is deep inside the Popup control and hard to overcome. If you are willing to do some work it can be done by resizing and translating the content of the popup when it reaches the screen edges. For the purposes of the demonstration, we'll focus on the left edge of the screen. If we have some XAML like this: <Window ...

Setting the start position for OpenFileDialog/SaveFileDialog

淺唱寂寞╮ 提交于 2019-11-30 17:06:01
For any custom dialog (form) in a WinForm application I can set its size and position before I display it with: form.StartPosition = FormStartPosition.Manual; form.DesktopBounds = MyWindowPosition; This is particularly important when dealing with multiple monitors. Without such code, when you open a dialog from an application that you have dragged to a second monitor, the dialog appears on the primary monitor. This presents a poor user experience. I am wondering if there are any hooks to set the position for the standard .NET OpenFileDialog and SaveFileDialog (which do not have a StartPosition