如何得到控件在屏幕中的位置 有如下要求,在Form1中有許多Button,現在是new Form2時,Form2的show位置要緊靠Button,Button位置不同Form2的位置就不同,而不是WindowsDefaultBounds,CenterParent,CenterScreen,Manual之類。有辦法嗎? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Form2 f = new Form2();f.Location = Button.Location; use "Control.PointToScreen" method 嗯Control.PointToScreen+Control.Location+Control.Size Form2 f = new Form2(); Point p = this.PointToScreen(button1.Location); p.X = p.X + button1.Width; p.Y = p.Y + button1.Height; f.StartPosition = FormStartPosition.Manual; f.SetDesktopBounds(p.X, p.Y, f.Width, f.Height); f.ShowDialog(this); 如何在treeview的节点前面添加图标?高分求最佳方案 C#自动获得数据库表的字段的名称、类型、字段属性问题 ★★★为什么绝大多数系统的用户名和密码不支持中文?★★★ 关于Datagrid中模板列的问题 为什么一调用窗体的show方法后,就退出程序 c# public放在类的前面! 两个exe文件a,b,其中a调用b,怎样让b彻底关闭a文件 用WebClient.UploadValues 在POST时汉字的编码方式为UTF-8,如何改为其它方式? c#怎么编客户端程序获取客户端的checkbox的值 如何得到机器的IP地址 连接 ComboBox下拉列表不能显示
f.Location = Button.Location;
+
Control.Location
+
Control.Size
Point p = this.PointToScreen(button1.Location);
p.X = p.X + button1.Width;
p.Y = p.Y + button1.Height;
f.StartPosition = FormStartPosition.Manual;
f.SetDesktopBounds(p.X, p.Y, f.Width, f.Height);
f.ShowDialog(this);