CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

如何隐藏一个标题栏,不要BORDSTYLE=0

楼主smallhawk001()2001-12-10 15:17:14 在 VB / 基础类 提问

我需要API函数解决方案  
  把标题栏隐藏,然后还能显示。 问题点数:24、回复次数:1Top

1 楼fraser01(王晓栋)回复于 2001-12-10 15:22:44 得分 24

关于这个问题以前已经有了解答,以后请搜索一下以前的贴子,以免浪费时间。  
   
  窗体:  
  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  
                          lStyle   =   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   True  
  End   Sub  
   
  Private   Sub   Command2_Click()  
          ShowTitleBar   False  
  End   Sub  
   
   
  模块:  
  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   GetWindowLong   Lib   "user32"   Alias   "GetWindowLongA"   (ByVal   hwnd   As   Long,   ByVal   nIndex   As   Long)   As   Long  
  Public   Declare   Function   FlashWindow   Lib   "user32"   (ByVal   hwnd   As   Long,   ByVal   bInvert   As   Long)   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   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  
  Public   Enum   ESetWindowPosStyles  
          SWP_SHOWWINDOW   =   &H40  
          SWP_HIDEWINDOW   =   &H80  
          SWP_FRAMECHANGED   =   &H20  
          SWP_NOACTIVATE   =   &H10  
          SWP_NOCOPYBITS   =   &H100  
          SWP_NOMOVE   =   &H2  
          SWP_NOOWNERZORDER   =   &H200  
          SWP_NOREDRAW   =   &H8  
          SWP_NOREPOSITION   =   SWP_NOOWNERZORDER  
          SWP_NOSIZE   =   &H1  
          SWP_NOZORDER   =   &H4  
          SWP_DRAWFRAME   =   SWP_FRAMECHANGED  
          HWND_NOTOPMOST   =   -2  
  End   Enum  
   
  Public   Declare   Function   GetWindowRect   Lib   "user32"   (ByVal   hwnd   As   Long,   lpRect   As   RECT)   As   Long  
  Public   Type   RECT  
          Left   As   Long  
          Top   As   Long  
          Right   As   Long  
          Bottom   As   Long  
  End   Type  
  Top

相关问题

  • 如何隐藏标题栏?
  • 如何隐藏标题栏?
  • ==如何隐藏窗口的标题栏??
  • 怎样隐藏DataGrid的标题栏?
  • 如何隐藏IE的标题栏(主要是想隐藏标题栏上的关闭按钮)--在线等
  • 如何隐藏IE的标题栏(主要是想隐藏标题栏上的关闭按钮)--在线等
  • 在C++Builder中如何隐藏标题栏?
  • 使用菜单的时候能不能隐藏标题栏?
  • 如何隐藏IE标题栏中Microsoft Internet Explorer字样?
  • 窗口标题栏隐藏的困难问题

关键词

  • ws
  • me
  • lstyle
  • 标题栏
  • showtitlebar
  • caption
  • swp
  • byval
  • hwnd
  • tr

得分解答快速导航

  • 帖主:smallhawk001
  • fraser01

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo