VB无边框问题

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:55:01
Dim mouse_x As Single
Dim mouse_y As Single

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
If Button = 1 Then
mouse_x = X
mouse_y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then

Form1.Left = Form1.Left + (X - mouse_x)
Form1.Top = Form1.Top + (Y - mouse_y)

End If
End Sub

窗体这样无边框移动之后,加了一个最小化按扭,最小化之后,无法在任务栏上显示,从此消失了,要结束进程关闭重来……有什么办法?

添加系统托盘图标吧

当窗体的 ControlBox 属性为 False,Caption 为空时,一样可以去掉标题栏。

不用更改窗体的 BorderStyle 属性,采用默认设置 2
将窗体的 ControlBox 属性设置为 False
Private Sub Form_Load()
Me.Caption = ""
End Sub
Private Sub Command1_Click()
Me.WindowState = 1 '最小化
End Sub

Private Sub Command1_Click()
End
End Sub 退出按扭

窗体的 ShowInTaskbar 选择为 True

这样就能看到任务栏了...

如果要关闭窗体则在任意事件下写End