C#拖放时更改表单大小(C# Change form size on drag and drop)

编程入门 行业动态 更新时间:2024-10-24 05:18:05
C#拖放时更改表单大小(C# Change form size on drag and drop)

我想知道是否可以在移动时更改表单的大小?

我想用此完成的是,当用户在两个不同的屏幕之间移动表单时,表单应该改变其大小以适应新的屏幕。

我尝试使用DragDrop操作表单,但没有工作。

请帮忙!

I would like to know if it is possible to change the size of the form when it is moved?

What I want to accomplish with this, is that when a user moves the form between 2 different screens the form should change its size to fit the new screen.

I tried with the DragDrop action for the Form but didn't work.

Please help!

最满意答案

你有没有检查Move方法是否可以帮到你?

private void Form1_Move(object sender, EventArgs e) { MessageBox.Show(this.Left.ToString()); }

上面的示例提示您表单的左侧位置,以便您可以检查表单的当前位置,并在必要时尝试调整其大小。

Have you check if Move method can help you ?

private void Form1_Move(object sender, EventArgs e) { MessageBox.Show(this.Left.ToString()); }

The example above prompt the left position of your form, so you can check the current position of your Form and try to resize it if necessary.

更多推荐

本文发布于:2023-08-04 13:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   拖放   大小   Change   drop

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!