运行中隐藏标题栏的问题
我练习编一个在运行中隐藏显示标题栏的程序 ,但是隐藏时整个窗口都被隐藏,大家能看看哪里错了吗?窗体上只有一个checkbox控件Private Sub Check1_Click()
If Check1.Value = 1 Then
TitleBar False
Else
TitleBar True
End If
End Sub
Public Function TitleBar(ByVal bstate As Boolean)
Dim lstyle As Long
Dim tr As RECT
GetWindowRect Me.hwnd, tr
lstyle = GetWindowLong(Me.hwnd, -16)
If bstate Then
Me.Caption = Me.Tag
If Me.ControlBox Then
lstyle = lstyle Or &H80000
End If
If Me.MaxButton Then
lstyle = lstyle Or &H10000
End If
If Me.MinButton Then
lstyle = lstyle Or &H20000
End If
If Me.Caption <> "" Then
lstyle = lstyle Or &HC00000
End If
Else
Me.Tag = Me.Caption
Me.Caption = ""
lstyle = lstyle Or Not &H80000
lstyle = lstyle Or Not &H10000
lstyle = lstyle Or Not &H20000
lstyle = lstyle Or Not &HC00000
End If
SetWindowLong Me.hwnd, -16, lstyle
SetWindowPos Me.hwnd, 0, tr.left, tr.top, tr.right - tr.left, tr.bottom - tr.top, &H200 Or &H4 Or &H20
End Function