c#怎么让两个独立窗体在屏幕上并排平铺? 因为不是mdi父子级的子窗体,要怎么做??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我是c#初学者,所以用了初学者的方法,大家勿笑~~ private void button1_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); Form3 frm3 = new Form3(); frm2.StartPosition = FormStartPosition.Manual; frm3.StartPosition = FormStartPosition.Manual; frm2.Left = (Screen.AllScreens[0].Bounds.Width - (frm2.Width + frm3.Width)) / 2;//设置第一个窗体距离屏幕左边的距离 frm3.Left = (Screen.AllScreens[0].Bounds.Width - (frm2.Width + frm3.Width)) / 2 + frm2.Height;//设置第二个窗体距离屏幕左边的距离; frm2.Show(); frm3.Show(); } 在两个窗体的load事件中 确定它们的位置就好了 发现窗体的位置只能通过StartPosition属性设置,而这个属性只提供了5种位置选项,很不够!今天在网上找到了一个解决的方法,如下:int x= System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width/2;int y=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height /2;this.SetDesktopLocation(x,y);注释:System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width; //当前显示器的宽度System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height; //当前显示器的高度this.SetDesktopLocation(x,y); //设置窗体打开后在显示器上的坐标本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hejialin666/archive/2010/01/28/5266372.aspx 用c#来获取局域网内的所有ip地址,计算机名称,监控每个ip网络流量,急急急!!! 关于MDI窗体的问题 新人麻烦问个小问题 怎样通过程式删除服务器上虚拟目录下的文件夹? C#WINFORM如何将access数据库的父子表一起导入到DataGrid控件中 gridview中的checkbox列中的值怎么转换 正则表达式批对 请问如果不装VS.net能用别的方法运行和调试C#程序吗? 简单问题!case如何使用啊? 日期字段如何查询? 怎么知道C#工程里的所有命名空间 C# 窗体和多线程问题
{
Form2 frm2 = new Form2();
Form3 frm3 = new Form3();
frm2.StartPosition = FormStartPosition.Manual;
frm3.StartPosition = FormStartPosition.Manual;
frm2.Left = (Screen.AllScreens[0].Bounds.Width - (frm2.Width + frm3.Width)) / 2;//设置第一个窗体距离屏幕左边的距离
frm3.Left = (Screen.AllScreens[0].Bounds.Width - (frm2.Width + frm3.Width)) / 2 + frm2.Height;//设置第二个窗体距离屏幕左边的距离;
frm2.Show();
frm3.Show();
}
int y=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height /2;
this.SetDesktopLocation(x,y);注释:
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width; //当前显示器的宽度
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height; //当前显示器的高度
this.SetDesktopLocation(x,y); //设置窗体打开后在显示器上的坐标本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hejialin666/archive/2010/01/28/5266372.aspx