admin 管理员组文章数量: 1184232
XP系统下设置双显的过程
电脑:AUSUS K50I
显卡为NVIDIA N1-0P-GE
在桌面上右击,选属性。在弹出窗口中找到设置选项卡,会看到有两个显示器编号。点选 2 号显示器。在下面找到两个选项,先选择下面的扩展桌面到此监视器,然后再选上面的设置此显示器为主显示器。点下面的应用按钮,然后选 1 号显示器,把下面两个选项中的扩展桌面到此监视器这个选项取消选择,就可以了。
2、一些应用程序在双显时的特性
(1) PPT
把PPT拖到副显,此时按F5放映PPT。却是在主显示PPT全屏放映,而副显还是显示编辑状态的PPT。
(2) RDP
RDP7不支持双显。Win7 下的RDP才支持双显。
(3) 按Ptr Sc键,把桌面的屏幕保存到mspaint中,此时看到是两个屏幕的和。
长*宽是否2646*768 ,这个大小就是双显的大小
可以看到2646是主显的分辩率的宽+副显的分辨率的宽。(1280+1366)
Introduction
This has been an ongoing topic for a while and I keep on getting question(s) on how can we launch Windows or in our case application(s) in different screens . In the place that I currently work, , we have many different types of adapters for many A/V systems and the applications like Lucky Draw, Slot Results, etc. have to be automatically launched on the correct AV to have effects like Animation(s) on one type, random numbers on other, etc.
Launcher
Launched
The AllScreens
This is all it takes to get the information of all the screens currently hosted in the system
System.Windows.Forms.Screen
.
So to populate our dropdown; loop through the:
Screen[] scr = Screen.AllScreens
this.cmbDevices.Items.Clear();
foreach (System.Windows.Forms.Screen s in scr)
{
strDeviceName = s.DeviceName.Replace("\\\\.\\", "");
this.cmbDevices.Items.Add(strDeviceName);
// you can check the device is primary or not this way
if (s.Primary) this.cmbDevices.Items.Add(">" + strDeviceName);
else this.cmbDevices.Items.Add(strDeviceName);
}
this.cmbDevices.SelectedIndex = 0;Launch
There are only two properties that have to be set correctly in order to ensure it is properly launched into the correct display.
Form.StartPosition
&
Form.Location
.
Screen[] scr = Screen.AllScreens
Form oForm = new Form()
oForm.Left = scr[0].Bounds.Width;
oForm.Top = scr[0].Bounds.Height;
oForm.StartPosition = FormStartPosition.Manual;
oForm.Location = scr[0].Bounds.Location;
oForm.Show();Putting It All Together
Here we go, this is all it takes to launch your forms into user selected display.
public partial class frmMain : Form
{
Form[] aryForms = new Form[5]; // Allow 5 total forms.
int currentPointer = 0; //
Screen[] scr = Screen.AllScreens;
public frmMain()
{
InitializeComponent();
LoadScreen();
}
private void LoadScreen()
{
String strDeviceName = String.Empty;
this.cmbDevices.Items.Clear();
foreach (Screen s in scr)
{
strDeviceName = s.DeviceName.Replace("\\\\.\\", "");
this.cmbDevices.Items.Add(strDeviceName);
/* Enable this section, if you want to point to
user this is the default screen.
if (s.Primary) this.cmbDevices.Items.Add(">" + strDeviceName);
else this.cmbDevices.Items.Add(strDeviceName);
*/
}
this.cmbDevices.SelectedIndex = 0;
}
private void btnLaunchIn_Click(object sender, EventArgs e)
{
int intLaunchScreen = getScreenNumber(this.cmbDevices.SelectedItem.ToString());
if (currentPointer <= 4)
{
aryForms[currentPointer] = new frmLaunchedWindow();
aryForms[currentPointer].Text =
aryForms[currentPointer].Text + currentPointer;
aryForms[currentPointer].Left = scr[intLaunchScreen].Bounds.Width;
aryForms[currentPointer].Top = scr[intLaunchScreen].Bounds.Height;
aryForms[currentPointer].StartPosition = FormStartPosition.Manual;
aryForms[currentPointer].Location = scr[intLaunchScreen].Bounds.Location;
//Point p = new Point(scr[0].Bounds.Location.X, scr[0].Bounds.Location.Y);
//aryForms[currentPointer].Location = p;
aryForms[currentPointer].Show();
currentPointer += 1;
}
}
private int getScreenNumber(String DeviceID)
{
int i = 0;
foreach (Screen s in scr)
{
if (s.DeviceName == "\\\\.\\"+DeviceID) return i;
i += 1;
}
// if cannot find the device reset to the default 0
return 0;
}
}二、 Windows 下的多显介绍
Positioning Objects on a Multiple Display Setup
The following sample code demonstrates how applications can correctly position objects on multiple displays . Note, do not assume that the RECT is based on the origin (0,0).
#include <windows.h>
#include "multimon.h"
#define MONITOR_CENTER 0x0001 // center rect to monitor
#define MONITOR_CLIP 0x0000 // clip rect to monitor
#define MONITOR_WORKAREA 0x0002 // use monitor work area
#define MONITOR_AREA 0x0000 // use monitor entire area
//
// ClipOrCenterRectToMonitor
//
// The most common problem apps have when running on a
// multimonitor system is that they "clip" or "pin" windows
// based on the SM_CXSCREEN and SM_CYSCREEN system metrics.
// Because of app compatibility reasons these system metrics
// return the size of the primary monitor.
//
// This shows how you use the multi-monitor functions
// to do the same thing.
//
void ClipOrCenterRectToMonitor(LPRECT prc, UINT flags)
{
HMONITOR hMonitor;
MONITORINFO mi;
RECT rc;
int w = prc->right - prc->left;
int h = prc->bottom - prc->top;
//
// get the nearest monitor to the passed rect.
//
hMonitor = MonitorFromRect(prc, MONITOR_DEFAULTTONEAREST);
//
// get the work area or entire monitor rect.
//
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
if (flags & MONITOR_WORKAREA)
rc = mi.rcWork;
else
rc = mi.rcMonitor;
//
// center or clip the passed rect to the monitor rect
//
if (flags & MONITOR_CENTER)
{
prc->left = rc.left + (rc.right - rc.left - w) / 2;
prc->top = rc.top + (rc.bottom - rc.top - h) / 2;
prc->right = prc->left + w;
prc->bottom = prc->top + h;
}
else
{
prc->left = max(rc.left, min(rc.right-w, prc->left));
prc->top = max(rc.top, min(rc.bottom-h, prc->top));
prc->right = prc->left + w;
prc->bottom = prc->top + h;
}
}
void ClipOrCenterWindowToMonitor(HWND hwnd, UINT flags)
{
RECT rc;
GetWindowRect(hwnd, &rc);
ClipOrCenterRectToMonitor(&rc, flags);
SetWindowPos(hwnd, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}三、 RepositioningWindows on Multiple Monitor Systems
参考代码:
Introduction
On systems with more than one display, you can get into trouble because of compatibility issues for functions like:
SystemParametersInfo( SPI_GETWORKAREA, 0, &rc, 0 );//only primary MonitorHere is a possible setup for two displays: the left (1) is the standard monitor, and the right (2) is the extension monitor, for instance, for less needed information like help, e-mail, or browsing.
版权声明:本文标题:Windows双显大揭秘:如何无缝切换至第二显示器 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1770771312a3537398.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论