Maybe Screen.AllScreens[1]
is catching the first screen instead of the second, could try Screen.AllScreens[0]
, or do exactly like @vnbrs response, but instead of using DeviceName
would use Primary
Screen tela2 = Screen.AllScreens.FirstOrDefault(f => !f.Primary );
An idea, which I'm not sure, would be to check which monitor is running its main Form and then get the DeviceName
, using # Screen.FromHandle
, supposing that it is within the class would apply this
, library_details.screen.fromhandle (v = vs.110) .aspx " following the suggestion of @MatheusMiranda , you may want to pass Window:
Screen principal = Screen.FromHandle(new WindowInteropHelper(this).Handle);
string nomedispositivo = principal.DeviceName;
Maybe you'll pass an element inside the Window, it would look like this with Screen.FromControl
:
Screen principal = Screen.FromControl(<form vai aqui>);
string nomedispositivo = principal.DeviceName;
Then to get to the other screen would do this:
Screen tela2 = Screen.AllScreens.FirstOrDefault(f => f.DeviceName != nomedispositivo );