Take screenshot of multiple desktops of all visible applications and forms

i tried GetDesktopWindow() function but it doesn’t work properly. Of course not. The GetDesktopWindow function returns a handle to the desktop window. It doesn’t have anything to do with capturing an image of that window. Besides, the desktop window is not the same thing as “the entire screen”. It refers specifically to the desktop window. … Read more

Going fullscreen on secondary monitor

Extension method to Maximize a window to the secondary monitor (if there is one). Doesn’t assume that the secondary monitor is System.Windows.Forms.Screen.AllScreens[2]; using System.Linq; using System.Windows; namespace ExtendedControls { static public class WindowExt { // NB : Best to call this function from the windows Loaded event or after showing the window // (otherwise window … Read more

Restoring Window Size/Position With Multiple Monitors

Try this code. Points of interest: Checks if the window is (partially) visible on any screen’s working area. E.g. dragging it behind the task bar or moving it completely offscreen resets the position to windows default. Saves the correct bounds even if the Form is minimized or maximized (common error) Saves the WindowState correctly. Saving … Read more

window.open() on a multi-monitor/dual-monitor system – where does window pop up?

Result of “window.open dual-screen” search revealed this fancy nugget: Dual Monitors and Window.open “When the user clicks on a link that opens a new window using window.open. Make the window appear on the same monitor as its’ parent.” // Find Left Boundry of the Screen/Monitor function FindLeftScreenBoundry() { // Check if the window is off … Read more

How do I ensure a form displays on the “additional” monitor in a dual monitor scenario? [duplicate]

You need to use the Screen class to find a screen that the original form is not on, then set the second form’s Location property based on that screen’s Bounds. For example: var myScreen = Screen.FromControl(originalForm); var otherScreen = Screen.AllScreens.FirstOrDefault(s => !s.Equals(myScreen)) ?? myScreen; otherForm.Left = otherScreen.WorkingArea.Left + 120; otherForm.Top = otherScreen.WorkingArea.Top + 120; This … Read more

Show JFrame in a specific screen in dual monitor configuration

public static void showOnScreen( int screen, JFrame frame ) { GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); if( screen > -1 && screen < gs.length ) { gs[screen].setFullScreenWindow( frame ); } else if( gs.length > 0 ) { gs[0].setFullScreenWindow( frame ); } else { throw new RuntimeException( “No Screens Found” ); } }