在窗口的中间有一个System.Windows.Forms.PictureBox控件(该控件区域的面积为所在窗口的1/4),当该控件的大部分区域落在其中一台显示器时,在另一台显示器将不显示该控件,(该PictureBox控件将移动到主显示器所在的窗口区域)。  
实现方法:
using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data; 
namespace WindowsApplication12 
/// <summary> 
/// Summary description for Form1. 
/// </summary> 
public class Form1 : System.Windows.Forms.Form 
private int tmpx = 0; 
private int tmpy = 0; 
private System.Windows.Forms.PictureBox pictureBox1; 
/// <summary> 
/// Required designer variable. 
/// </summary> 
private System.ComponentModel.Container components = null; 
System.Drawing.Rectangle[] ScreensRect; 
public Form1() 
// 
// Required for Windows Form Designer support 
// 
InitializeComponent(); 
// 
// TODO: Add any constructor code after InitializeComponent call 
// 
/// <summary> 
/// Clean up any resources being used. 
/// </summary> 
protected override void Dispose( bool disposing ) 
if( disposing ) 
if (components != null) 
components.Dispose(); 
base.Dispose( disposing ); 
#region Windows Form Designer generated code 
/// <summary> 
/// Required method for Designer support - do not modify 
/// the contents of this method with the code editor. 
/// </summary> 
private void InitializeComponent() 
this.pictureBox1 = new System.Windows.Forms.PictureBox(); 
this.SuspendLayout(); 
// 
// pictureBox1 
// 
this.pictureBox1.BackColor = System.Drawing.SystemColors.HotTrack; 
this.pictureBox1.Location = new System.Drawing.Point(120, 88); 
this.pictureBox1.Name = "pictureBox1"; 
this.pictureBox1.Size = new System.Drawing.Size(248, 176); 
this.pictureBox1.TabIndex = 0; 
this.pictureBox1.TabStop = false; 
// 
// Form1 
// 
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 
this.ClientSize = new System.Drawing.Size(504, 357); 
this.Controls.Add(this.pictureBox1); 
this.Name = "Form1"; 
this.Text = "Form1"; 
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); 
this.Load += new System.EventHandler(this.Form1_Load); 
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp); 
this.ResumeLayout(false); 
#endregion 
/// <summary> 
/// The main entry point for the application. 
/// </summary> 
[STAThread] 
static void Main() 
Application.Run(new Form1()); 
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) 
this.tmpx = e.X; 
this.tmpy = e.Y; 
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.form1_MouseMove); 
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) 
this.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.form1_MouseMove); 
System.Drawing.Rectangle pictureBox1Rect=Screen.GetWorkingArea(pictureBox1); 
for(int i=0;i<ScreensRect.Length;i++) 
if(ScreensRect[i].X==pictureBox1Rect.X && ScreensRect[i].Y==pictureBox1Rect.Y) 
this.Location=new Point(ScreensRect[i].X,pictureBox1Rect.Y); 
//MessageBox.Show(" WorkingArea:" + re.ToString()); 
private void form1_MouseMove(object sender, MouseEventArgs e) 
this.Location = new System.Drawing.Point(this.Location.X + e.X - this.tmpx, this.Location.Y + e.Y - this.tmpy); 
private void Form1_Load(object sender, System.EventArgs e) 
Screen[] s=Screen.AllScreens; 
ScreensRect=new Rectangle[s.Length]; 
for(int i=0;i<s.Length;i++) 
ScreensRect[i]= s[i].WorkingArea; 
}  

转载于:https://www.cnblogs.com/top5/archive/2010/12/13/1904820.html

C#多屏幕显示器编程相关推荐

  1. c语言显示器编程,VC实现Windows多显示器编程的方法

    本文实例讲述了VC实现Windows多显示器编程的方法.分享给大家供大家参考.具体如下: 一.Windows中接入多个显示器时,可设置为复制和扩展屏. 1.设置为复制屏幕时,多个显示器的分辨率是一样的 ...

  2. 如何使用java代码获取屏幕显示器个数

    使用java代码获取屏幕显示器个数,主要是使用java中的GraphicsEnvironment对象,关于GraphicsEnvironment对象的介绍,可以去GraphicsEnvironment ...

  3. 屏幕显示器及屏幕指标

    屏幕显示器 图与屏幕的关系: 图像是数据 屏幕是显示设备 图像数据经过驱动程序让屏幕显示图像 RGB的色彩问题: RGB于BGR 有的图像是由BGR排序的,驱动并未识别,需要转换成RGB BMP使用的 ...

  4. 为什么计算机桌面显示器,为什么电脑屏幕显示器的字体会模糊呢

    为什么电脑屏幕显示器的字体会模糊呢 使用集成显卡的电脑用久了之后,会出现显示器屏幕字体模糊的现象,在液晶显示器上发生的尤为明显.接下来小编就给大家介绍一下系统字体模糊到底是哪几方面造成的? 1主机电源 ...

  5. 用笔记本编程,强烈建议外接一个大屏幕显示器!(最好用HDMI接口)

    http://item.jd.com/1097163.html http://item.jd.com/1102166.html 注意: (1)我的笔记本型号是Thankpad E430C,视频接口有V ...

  6. c语言字符屏幕,C语言字符屏幕函数 - 编程资料 - Powered 万人网络编程学院 bcxy.yinese.com...

    Turbo C2.0的字符屏幕函数主要包括文本窗口大小的设定.窗口颜色的设置. 窗口文本的清除和输入输出等函数. 1.文本窗口的定义 Turbo C2.0默认定义的文本窗口为整个屏幕, 共有80列(或 ...

  7. 人机交互-广州DACAI触摸屏开发中遇到的一些(屏幕和编程)问题

    目录 背景 一.屏幕相关 1.厂家给的指令集资料可能有错误,请以软件VisualTFT中的指令助手为准. 2.屏幕程序下载方式 3.SD卡文件格式问题 4.画面id的问题  巨坑!!! 5.子画面变暗 ...

  8. miniui不显示textbox边框_新品发布艺卓推出31.5英寸4K超高清大屏幕显示器:EV3285...

    2019 年 2 月 27 日,艺卓宣布推出 FlexScan EV3285 ,这款显示器是 FlexScan 系列中的最新旗舰型号,也是 EV3237 的升级产品. 工作空间和效率均提升四倍 这款 ...

  9. logo下方显示技术支持信息_艺术与实用性的结合,iQunix Spider 屏幕显示器支架评测...

    前言: 有的时候,我们的桌面总是被各类数码产品所占据,笔记本电脑.显示器.PS4.无线键鼠.台灯.各类充电线和电源插排等等.对于简约桌面有着追求的人来说,繁杂的桌面让我们头疼,尤其是显示器,键盘,鼠标 ...

最新文章

  1. linux 调用栈打印
  2. SAP中会计凭证和物料凭证的对应关系
  3. SQL SERVER数据导入到EXCEL
  4. 实现picturecontrol控件显示图片_陕西曝光机触摸屏实时数据控件
  5. 外星人台式电脑_谈谈4万人民币的外星人R9台式机值不值得购买
  6. 数学--数论--莫比乌斯函数
  7. (专题二)01 矩阵的处理-特殊矩阵
  8. 两个vlan如何互通_网络交换机VLAN的常识与划分方法,你知道吗?
  9. 图算法——欧拉回路问题的解答
  10. jupyter notebook 修改默认文件夹
  11. 中jsp加载不出来layui_Maven+JSP+SSM+Mysql实现的学生选课系统
  12. Web安全漏洞介绍及防御-文件上传漏洞
  13. 计算机并口回路测试工具,COM口和LPT口回路环的制作与CheckIT3.0测试方法
  14. mysql至少选修了两门课程_数据库中用关系代数表达式,查询至少选修两门课程的学生的学号和姓名怎么写?...
  15. Kbone与小程序跨端开发的一些思考
  16. 2020-06 前端技术汇总
  17. MySQL批量修改库、表、列的排序规则
  18. uniapp 安卓平台应用启动时读写手机存储、访问设备信息(如IMEI)等权限
  19. Linux系统(Centos 7)配置主DNS 服务器实例
  20. Visual Studio安装及下载

热门文章

  1. 转载《Python与开源GIS教程》随书源码网址
  2. [转载] 蓝胡子国王的金钥匙
  3. Hough(霍夫变换) 基于Opencv2.4.9 和VS2012平台下编写
  4. GDAL中MEM格式的简单使用示例
  5. win10安装vbox没有虚拟网卡_消失的虚拟网卡
  6. mysql——event定时任务
  7. mysql——数据库事务(C#代码)
  8. 游戏中的影子制作技术
  9. java 修改win7系统时间_win7如何禁止更改系统时间
  10. Windows 系统 重装为Linux 记录