Imports System Drawing Imports System Windows Forms ****************************************** Private oOriginalRegion As Region = Nothing 用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point ****************************************** Private Sub Form _MouseDown(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseDown Me bFormDragging = True Me oPointClicked = New Point(e X e Y) End Sub ****************************************** Private Sub Form _MouseUp(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseUp Me bFormDragging = False End Sub ****************************************** Private Sub Form _MouseMove(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseMove If Me bFormDragging Then Dim oMoveToPoint As Point 以当前鼠标位置为基础 找出目标位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y)) 根据开始位置作出调整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y + _ SystemInformation CaptionHeight + _ SystemInformation BorderSize Height) * ) 移动窗体 Me Location = oMoveToPoint End If
创新互联公司主营昌图网站建设的网络公司,主营网站建设方案,app开发定制,昌图h5重庆小程序开发公司搭建,昌图网站营销推广欢迎昌图等地区企业咨询
lishixinzhi/Article/program/ASP/201311/21755
软件bug。vb.net创建是会有窗体进行应用的,没有应用就是软件bug原因,需要用户将软件关闭,点击系统修复下载,再打开软件即可。
把窗体的 Opacity 设为 0
ShowInTaskbar设为 False
或者不用窗体,做成控制台程序
VB6.0写的,代码很简单,无意中写成的。应该可以参考。不需要任何api函数。在无边框窗体顶部中放入一个label标签。然后用label的 mouse down 和mouse move事件实现
Dim a, b As Single
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
a = X
b = Y
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.Move Left + X - a, Top + Y - b
End If
End Sub
vb.net锁定除顶级窗体以外的操作步骤如下:
1、通过Show方法,用以显示MDIForm或Form对象。
2、当Show在显示无模式窗体时,随后遇到的代码则要执行。
3、当Show在显示模式窗体时,则随后的代码直到该窗体被隐藏或卸载时执行即可。
设置窗体的text为空,设置窗体的controlbox属性为false,设置窗体的FormBorderStyle 属性为Sizable,就可以改变窗体大小了,并且可以在任务栏点击。