如何编写代码以在桌面上拖放(表格的)标签,然后表格随之移动? [英] How to code to drag and drop Label (of Form) on the desktop then the Form moves to follow it?

查看:123
本文介绍了如何编写代码以在桌面上拖放(表格的)标签,然后表格随之移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题-运行应用程序时将其拖放到窗体中,然后窗体随之移动,即此Label类似于窗体的标题栏.我应该对Label的哪个事件进行编码才能做到这一点?怎么编码?谢谢.

I have a problem - draging and dropping a Label (in a Form) when I run application then the Form moves to follow it, i.e, this Label is like Title bar of Form. What event of Label should I code to do this? How to code? Thanks.

推荐答案

我不是100%知道"...表格随之而来"的意思,但我认为您是什么意思.寻找标签上的anchor属性.您可以设置它应如何粘贴"到表单.因此,如果只是选择将其锚定在顶部,则在调整表单大小时,它将停留在顶部并相对于顶部保持其位置.如果您说锚点应该在顶部和左侧(通常是在窗体上拖放标签时的默认值),它将粘在"左上角.如果将锚点"设置为左,上,右",则在调整窗体大小时,它将粘在"顶部并拉伸/缩小.在找到所需的确切设置之前,应先进行操作.

此处 [
I''m not 100% sure what you mean by "...the form moves to follow it.", but I think what you are looking for is the anchor property on the label. You can set how it should "stick" to the form. So if you just select that it anchors to the top, it will stay at the top and keep it''s location relative to the top when the form is resized. If you say the anchor should be top and left (typically this is the default when you drag and drop a label on the form) it will "stick" to the top left corner. If you set Anchor to Left, Top, Right it will "stick" to the top and stretch/shrink when you resize the form. You should play with it a bit until you find the exact setting you are looking for.

Here[^] is the MSDN for the anchor property.

Hope this helps.



浏览这篇文章:
http://community.sharpdevelop.net/forums/p/5713/16376.aspx
Hi,
Go through this article:
http://community.sharpdevelop.net/forums/p/5713/16376.aspx


这篇关于如何编写代码以在桌面上拖放(表格的)标签,然后表格随之移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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