| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3685 人关注过本帖
标题:如何隐藏标题栏
只看楼主 加入收藏
zc6618
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2009-7-14
收藏
 问题点数:0 回复次数:3 
如何隐藏标题栏
各位大侠,我刚接触vb6,想把标题栏隐藏,将borderstyle设置为0-None后,加了一个菜单运行后,标题栏有出来了,请问怎么解决?
搜索更多相关主题的帖子: 隐藏 
2009-07-20 00:18
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
收藏
得分:0 
Public Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As Rect) As Long

Public Const GWL_STYLE = (-16)
Public Const WS_CAPTION = &HC00000
Public Const WS_MAXIMIZEBOX = &H10000
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_SYSMENU = &H80000

Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = (-20)
Public Const LWA_ALPHA = &H2
Public Const LWA_COLORKEY = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1

Public Const flags = SWP_NOMOVE Or SWP_NOSIZE

Public Function ShowTitleBar(Frm As Form, ByVal bState As Boolean, Optional H As Long, Optional W As Long)  '去除窗体标题栏
    Dim lStyle As Long
    Dim tR As Rect

    GetWindowRect Frm.hWnd, tR
    lStyle = GetWindowLong(Frm.hWnd, GWL_STYLE)
    If (bState) Then
    '    Frm.Caption = Frm.Tag
            If Frm.ControlBox Then
                lStyle = lStyle Or WS_SYSMENU
            End If
            If Frm.MaxButton Then
                lStyle = lStyle Or WS_MAXIMIZEBOX
            End If
            If Frm.MinButton Then
                lStyle = lStyle Or WS_MINIMIZEBOX
            End If
            If Frm.Caption <> "" Then
                lStyle = lStyle Or WS_CAPTION
            End If
    Else
        'Frm.Tag = Frm.Caption
        'Frm.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 Frm.hWnd, GWL_STYLE, lStyle
    Frm.Height = H
    Frm.Width = W
End Function
收到的鲜花
  • zc66182009-07-20 21:50 送鲜花  2朵   附言:学习了,谢谢
2009-07-20 10:13
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
收藏
得分:0 
Option Explicit

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000

Private Sub Form_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim dwStyle&
    dwStyle& = GetWindowLong(Me.hWnd, GWL_STYLE)
    SetWindowLong Me.hWnd, GWL_STYLE, dwStyle& And (Not WS_CAPTION)
End Sub
收到的鲜花
  • zc66182009-07-20 21:50 送鲜花  2朵   附言:学习了,谢谢
2009-07-20 13:34
zc6618
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2009-7-14
收藏
得分:0 
谢谢两位大侠哈,问题已解决!
2009-07-20 21:51
快速回复:如何隐藏标题栏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015339 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved