动态设定窗体的BorderStyle
或者使用API函数!
或者使用API函数!
解决方案 »
- VB获取外部数据
- VB使用winsock控件的一些疑问
- vb调用mysql数据库表,数据库编码是urf8,结果中文字符显示乱码
- 请问如何直接在程序里自动注册控件
- MSHFlexGrid1背景色问题
- 清问Modules和Class Modules有什么区别?
- 如何打开文本,然后清空内容,然后写一些字符串进去呢
- 怎样在VB中即能看中文注释,又能正确显示日文注释!
- 怎样升级天网防火墙个人版测试版(2.48)为正式版
- 请问:从那里可以下载到最新版本的installshield?急用!
- 还有一个问题:我用的是XP,可是用VB6做出来的东西还是老土的按钮,有办法吗?
- 有那几种网格空件可以用两种颜色交替显示网格?
Me.Caption = ""
End SubPrivate Sub Command2_Click()
Me.Caption = "asdf"
End Sub
我想在设计时让controlbox=true
在运行时使controlbox=false
form_load
ShowTitleBar false
.....
Private Function 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
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
End Function
(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
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
End Function
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
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
End Function
'先设定form1.controlbox=falsePrivate Sub Form_Load()
With Me
.BorderStyle = 3
.Tag = .Caption
.Caption = ""
.RefreshEnd WithEnd Sub