我们如何使用鼠标事件在运行时在所需位置更改多个控件的位置 [英] How we can change position of multiple controls at runtime in the required position using mouse events

查看:71
本文介绍了我们如何使用鼠标事件在运行时在所需位置更改多个控件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助..

QtN:我创建了几个用户控件,并在运行时将这些控件添加到窗体中.

控件已添加,但位置未更改.如何使用鼠标事件(如拖放,移动,...其他事件)更改这些位置

我希望这些位置仅在运行时更改

如果有人知道给出答案.

问候&
谢谢

venkat

help please ..

QtN:i created several user controls and i added those controls to form at runtime.

controls are added but positions not changed .how we can changes those positions using mouse events like drag&Drop,move,... other events

i want those positions changes only runtime

if anyone know give ans.

regards&
thanks

venkat

推荐答案

更改Control.Location属性.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.location.aspx [ ^ ]
Change the Control.Location property.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.location.aspx[^]
Point oldLoc = MyControl.Location;
MyControl.Location = new Point(oldLoc.X + 10, oldLoc.Y + 10);


这篇关于我们如何使用鼠标事件在运行时在所需位置更改多个控件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆