【发布时间】:2020-05-25 15:49:14
【问题描述】:
我有一个没有边框样式的 form1,我想让这个表单在用户移动 panel1 时移动。 在进行简单的搜索后,我发现这个解决方案 C# 的情况相同
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Location = new Point(Cursor.Position.X + e.X , Cursor.Position.Y + e.Y);
}
}
对于我的情况,我使用 vb.net,所以我尝试制作类似的代码但我失败了:
Private Sub Panel1_MouseMove(sender As Object, e As MouseEventArgs) Handles GunaPanel1.MouseMove
If e.Button = MouseButtons.Left Then
MainDashboard.Location = New Point(Cursor.Position.X + e.X, Cursor.Position.Y + e.Y)
End If
End Sub
【问题讨论】:
-
你哪里失败了?使用 c# 到 vb 转换器
-
当我将它转换为 vb.net 时它不起作用
-
什么是 MainDashboard?是表格名称吗?
-
是的,这是我的表单名称
-
这是面板所在的当前表单名称?