怎样获取某个控件在整个WINDOW屏幕中的切实位置 请问各位大哥: 怎样获取某个控件在整个WINDOW屏幕中的切实位置?因为我发现控件的location属性 并不是其在window屏幕中的切实位置来的,可能是相对于整个winform窗口的相对位置吧? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 use System.Windows.Forms.Screen this.PointToScreen(button1).X; //横this.PointToScreen(button1).Y; //纵 以下这样也行,以下是把控件的内容保存到图片中Size size = new Size(panel1.Width, panel1.Height);//拿到PANEL大小 Image img = new Bitmap(size.Width,size.Height);//定义一张相同大小的图片 Graphics g = Graphics.FromImage(img);//拿到图片的绘图对象 g.CopyFromScreen(this.Location.X + SystemInformation.FrameBorderSize.Width + panel1.Location.X, this.Location.Y + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height + panel1.Location.Y,0,0,size); //开始捕捉屏幕到图片中 System.Windows.Forms.Control.MousePosition不是很了解,帮你看了下你看下Windows.Forms下的属性有没有适合你的 如何获取类中属性的名称 急、C# 实现省市级联菜单、 excel读取问题 有用过DevExpress的Xtragrid的吗?合并单元格问题 C#莫名奇妙的异常,有人遇到过没??? 如何用代码实现将一个RSA密钥放入Windows系统的密钥容器中? RDA的实现方式?如何自己实现Push、Pull方法? 请教一个关于正则表达式的问题??? 在一个textbox里面输入字符,但是使其显示为******(密码形式) 怎样让 windows窗体一启动就在屏幕正中央显示。 关于Windows Mobile的问题 C# 多线程调用com
System.Windows.Forms.Screen
this.PointToScreen(button1).Y; //纵
Size size = new Size(panel1.Width, panel1.Height);//拿到PANEL大小 Image img = new Bitmap(size.Width,size.Height);//定义一张相同大小的图片 Graphics g = Graphics.FromImage(img);//拿到图片的绘图对象 g.CopyFromScreen(this.Location.X + SystemInformation.FrameBorderSize.Width + panel1.Location.X, this.Location.Y + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height + panel1.Location.Y,0,0,size); //开始捕捉屏幕到图片中
不是很了解,帮你看了下
你看下Windows.Forms下的属性有没有适合你的