象外行一样思考,象专家一样实践。
coolbean | 10 九月, 2007 02:16
This tip shows you how to show and hide the title bar of a window at run-time. To make a window's title bar disappear, you have to remove the control box, the maximise box and the minimise box as well as set the caption of the form to blank. Unfortunately, VB's ControlBox, MinButton and MaxButton properties of a form are read-only so you can normally only do this at design time. However, by manipulating the style of the window using API calls, you can get the same thing to happen at run-time.
Start a new project in VB. Add the following code to the project's form:
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 Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000
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 Enum ESetWindowPosStyles
SWP_SHOWWINDOW = &H40
SWP_HIDEWINDOW = &H80
SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
SWP_NOACTIVATE = &H10
SWP_NOCOPYBITS = &H100
SWP_NOMOVE = &H2
SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
SWP_NOREDRAW = &H8
SWP_NOREPOSITION = SWP_NOOWNERZORDER
SWP_NOSIZE = &H1
SWP_NOZORDER = &H4
SWP_DRAWFRAME = SWP_FRAMECHANGED
HWND_NOTOPMOST = -2
End Enum
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
' Get the window's position:
GetWindowRect Me.hwnd, tR
' Modify whether title bar will be visible:
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
' Ensure the style takes and make the window the
' same size, regardless that the title bar etc
' is now a different size:
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
' Ensure that your resize code is fired, as the client area
' has changed:
Form_Resize
End Function
To try out the hiding and showing the title bar, add a CheckBox to the project's form. Set the check box's Value property to 1 (Checked). Then put the following code under the Check box's click event:
Private Sub Check1_Click()
If (Check1.Value = Checked) Then
ShowTitleBar True
Else
ShowTitleBar False
End If
End Sub
When you click on the check box, the form's titlebar will be alternately hidden and shown.
上海律师 | 26/05/2010, 11:59
代考CCNA | 26/05/2010, 16:04
代考CCNA,代考CCNP,代考思科,代考MCSE 2003,代考ORACLE 2008,代考VCP-410,代考CCNP,代考SCJP, 代考OCP代考Microsoft,代考IBM,透明酒盒IBM等,专业保证,您值得放心;更方便的是YES nano 可以由 USB-DC power cord充电,或是藉由随附的外接式 盒,确保随时都可使用。power cord 色卡司N2200提供2块3.5寸SATA ,最多可支持4TB存储容量。
f | 10/06/2010, 16:48
power cord | 09/07/2010, 15:49
power cord网站利用半年时间采用了如下网站推广策略: URL优化。power cord网站不断优化URL,提高URL与推广内容的关联性。冲击试验机例如搜索“塑料产品”,在搜索页的URL中包含了关键词和搜索条件。 热敏电阻中小企业特别需要有诚意、有能力帮助耐腐蚀泵中小企业成长的专业人士长期深入到企业中识别挑战、离心泵定义问题、洗地吸干机
剖析原因、压力试验机提出策略和解决方案.
power cord | 09/07/2010, 15:49
power cord网站利用半年时间采用了如下网站推广策略: URL优化。power cord网站不断优化URL,提高URL与推广内容的关联性。冲击试验机例如搜索“塑料产品”,在搜索页的URL中包含了关键词和搜索条件。 热敏电阻中小企业特别需要有诚意、有能力帮助耐腐蚀泵中小企业成长的专业人士长期深入到企业中识别挑战、离心泵定义问题、洗地吸干机
剖析原因、压力试验机提出策略和解决方案.
夏日黄山 | 12/07/2010, 16:51
CHU | 06/08/2010, 16:41
溧阳市良友活性炭厂是专业生产活性炭厂家。生产各类水处理活性炭,空气净化活性炭等。欢迎选购良友活
性炭。
上海川岛是一家集设计、制造、研究、销售工业洗衣机械系列产品,布草洗涤连锁加盟,洗衣厂技术,经营管理培训,洗衣材料销售代理于一体的-----专业型实体企业。主要经营产品大型洗衣设备,工业洗衣设备,大型洗衣机,洗衣设备,酒店洗衣设备,医院洗衣房设备
喷砂房,抛丸机选哪家好?徐州市振亮机械厂为你提供专业的喷砂房,抛丸机设备,欢迎选购。
上海力辉门业专业生产:防火卷帘门、防火卷帘、防火门、钢质防火卷帘门等,力辉门业努力创新、不断发展、以市场为导向、参考国内外同类产品、引进先进工艺技术和设备,设计研制、精心制造、以满足社会各界的需要,欢迎订购防火卷帘门,卷帘门,钢质防火卷帘。
ff | 25/08/2010, 16:16
| « | 九月 2010 | » | ||||
|---|---|---|---|---|---|---|
| 一 | 二 | 三 | 四 | 五 | 六 | 日 |
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
南京雪松黄山自古云成海,云赋于黄山冬景无穷的魅力——奇妙的雾松、雪松、树挂,把黄山妆扮得如同一个珊瑚盛开的世界。黄山旅游游客最多的季节是夏季,特别是七八月间。但许多游客称冬季为黄山最美的季节,冬季还是云海出现最多的季节,有时云海可持续三天不散,为了看全景可以黄山住宿。不过冬季,天都峰、白云溪封山,翡翠谷也无可观之处。黄山山下住宿“黄山四季皆胜景,惟有冬季景更佳”。黄山的冬季比较长,每年10月下旬左右就要飘雪了,江苏墙体广告11月至翌年3月全山飘雪,12月至翌年2月为最旺雪期,也是冬游的最佳季节;南京卫星电视安装网,南京安装卫星电视网承接南京及周边地区卫星电视安装服务,在南京安装卫星电视只要您一个电话,南京卫星电视我们会在24小时内上门为您安装。
南京雪松 | 25/05/2010, 14:46
南京雪松黄山自古云成海,云赋于黄山冬景无穷的魅力——奇妙的雾松、雪松、树挂,把黄山妆扮得如同一个珊瑚盛开的世界。黄山旅游游客最多的季节是夏季,特别是七八月间。但许多游客称冬季为黄山最美的季节,冬季还是云海出现最多的季节,有时云海可持续三天不散,为了看全景可以黄山住宿。不过冬季,天都峰、白云溪封山,翡翠谷也无可观之处。黄山山下住宿“黄山四季皆胜景,惟有冬季景更佳”。黄山的冬季比较长,每年10月下旬左右就要飘雪了,江苏墙体广告11月至翌年3月全山飘雪,12月至翌年2月为最旺雪期,也是冬游的最佳季节;南京卫星电视安装网,南京安装卫星电视网承接南京及周边地区卫星电视安装服务,在南京安装卫星电视只要您一个电话,南京卫星电视我们会在24小时内上门为您安装。