Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Private Function ShowTitleBar(ByVal bState As Boolean) Dim lStyle As Long Dim tR As RECT
GetWindowRect Me.hwnd, tR lStyle = GetWindowLong(Me.hwnd, GWL_STYLE) If (bState) Then Me.Caption = Me.Tag If Me.ControlBox Then lStyle = lStyle Or WS_SYSMENU End If If Me.MaxButton Then lStyle = lStyle Or WS_MAXIMIZEBOX End If If Me.MinButton Then Style = lStyle Or WS_MINIMIZEBOX End If If Me.Caption = "" Then lStyle = lStyle Or WS_CAPTION End If Else Me.Tag = Me.Caption Me.Caption = "" lStyle = lStyle And Not WS_SYSMENU lStyle = lStyle And Not WS_MAXIMIZEBOX lStyle = lStyle And Not WS_MINIMIZEBOX lStyle = lStyle And Not WS_CAPTION End If SetWindowLong Me.hwnd, GWL_STYLE, lStyle SetWindowPos Me.hwnd, 0, tR.Left, tR.Top, tR.Right - tR.Left, tR.Bottom - tR.Top, SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED Me.Refresh End Function
Private Sub Command1_Click() ShowTitleBar False End Sub
Private Sub Command2_Click() ShowTitleBar True End Sub
Если Вас заинтересовала или понравилась информация программирование на Visual Basic - "Спрятать/показать панель заголовка", Вы можете поставить закладку в социальной сети или в своём блоге на данную страницу: Так же Вы можете задать вопрос по работе этого модуля или примера через форму обратной связи, в сообщение обязательно указывайте название или ссылку на статью!