通过工具menuStrip1移动表单的位置 [英] moving the place of the form , through the tool menuStrip1

查看:150
本文介绍了通过工具menuStrip1移动表单的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码中的助手:通过工具menuStrip1移动网站表单(维护和移动表单的位置)!在Visual Basic Net?

Assistant in the code: Move the site form (in the maintenance of and moving the place of the form) through the tool menuStrip1! In Visual Basic Net?

推荐答案

使用 Form.Location

http://msdn.microsoft.com/en-us/library/ms159414.aspx [<一个href =http://msdn.microsoft.com/en-us/library/ms159414.aspxtarget =_ blanktitle =新窗口> ^ ]。



这取决于您需要使用的菜单条的哪些事件 - 您没有解释您想要的行为。但它也不应该是一个问题。



-SA


我认为是,你想要的:



I think that is, what you want:

' Some variables
Dim moveX, moveY As Integer
Dim newpoint As New Point

' Setting up Point 'newpoint'
Private Sub MnD() Handles MenuStrip1.MouseDown
moveX = Control.MousePosition.X - Me.Location.X
moveY = Control.MousePosition.Y - Me.Location.Y
End Sub

' Moving form through ToolStripMenu
Private Sub MnM(sender As Object, e As MouseEventArgs) Handles MenuStrip1.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
newpoint = Control.MousePosition
newpoint.X -= moveX
newpoint.Y -= moveY
Me.Location = newpoint
Application.DoEvents()
End If
End Sub





~Stefan Wittwer。



~ Stefan Wittwer.


这篇关于通过工具menuStrip1移动表单的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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