windForm中怎么样让一个窗体显示在另一个窗体的某个固定位置?
时间:2011-12-16
来源:互联网
不要用MDI那个,就是想让A窗体一出来就显示在B窗体里面的某个空白位置,而且鼠标移动B窗体时A窗体和B窗体的相对位置不变,也就是说A窗体也会跟着移动 就像是B窗体里面的一部分
作者: a873113580 发布时间: 2011-12-16
Form有个StartPosition属性 可以设置
作者: jiangfling 发布时间: 2011-12-16
移动要你自己做事件了
作者: jiangfling 发布时间: 2011-12-16
作者: gxingmin 发布时间: 2011-12-16
初始位置StartPosition 就可以了
跟随移动,在父窗口中move的事件中,对子窗口进行调整位置
部分参考代码
C# code
跟随移动,在父窗口中move的事件中,对子窗口进行调整位置
部分参考代码
C# code
//窗口移动 Point oldMousePoint = new Point(); bool isPanelCanMove = false; private void form_MouseDown(object sender, MouseEventArgs e) {//窗口移动 oldMousePoint = MousePosition; if (lbMax.Tag == null || lbMax.Tag.ToString() == "0") isPanelCanMove = true; } private void form_MouseUp(object sender, MouseEventArgs e) {//窗口移动 isPanelCanMove = false; } private void form_MouseMove(object sender, MouseEventArgs e) {//窗口移动 if (isPanelCanMove) { Point newMousePoint = MousePosition; this.childform.Location = new Point(this.childform.Location.X + newMousePoint.X - oldMousePoint.X, this.childform.Location.Y + newMousePoint.Y - oldMousePoint.Y); oldMousePoint = newMousePoint; } }
作者: qgj1655 发布时间: 2011-12-16
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28