让标题栏文字置中
时间:2006-11-24 23:49 来源:ACCESS设计在线 作者:想不通 阅读:次
文章正文:
Private Sub Form_Load()
CenterC Me
oldsize = Me.Width
End Sub
Private Sub Form_Resize()
If Me.Width = oldsize Then
Exit Sub
Else
CenterC Me
oldsize = Me.Width
End If
End Sub
以下放入模块,以后用时调用即可.
Public Sub CenterC(frm As Form)
Dim SpcF As Integer
Dim clen As Integer
Dim oldc As String
Dim I As Integer
oldc = frm.Caption
Do While Left(oldc, 1) = Space(1)
DoEvents
oldc = Right(oldc, Len(oldc) - 1)
Loop
Do While Right(oldc, 1) = Space(1)
DoEvents
oldc = Left(oldc, Len(oldc) - 1)
Loop
clen = Len(oldc)
If InStr(oldc, "!") <> 0 Then
If InStr(oldc, "") <> 0 Then
clen = clen * 1.5
Else
clen = clen * 1.4
End If
Else
If InStr(oldc, "") <> 0 Then
clen = clen * 1.4
Else
clen = clen * 1.3
End If
End If
SpcF = frm.Width / 61.2244
SpcF = SpcF - clen
If SpcF > 1 Then
DoEvents
frm.Caption = Space(Int(SpcF / 2)) + oldc
Else
frm.Caption = oldc
End If
End Sub
Private Sub Form_Load()
CenterC Me
oldsize = Me.Width
End Sub
Private Sub Form_Resize()
If Me.Width = oldsize Then
Exit Sub
Else
CenterC Me
oldsize = Me.Width
End If
End Sub
以下放入模块,以后用时调用即可.
Public Sub CenterC(frm As Form)
Dim SpcF As Integer
Dim clen As Integer
Dim oldc As String
Dim I As Integer
oldc = frm.Caption
Do While Left(oldc, 1) = Space(1)
DoEvents
oldc = Right(oldc, Len(oldc) - 1)
Loop
Do While Right(oldc, 1) = Space(1)
DoEvents
oldc = Left(oldc, Len(oldc) - 1)
Loop
clen = Len(oldc)
If InStr(oldc, "!") <> 0 Then
If InStr(oldc, "") <> 0 Then
clen = clen * 1.5
Else
clen = clen * 1.4
End If
Else
If InStr(oldc, "") <> 0 Then
clen = clen * 1.4
Else
clen = clen * 1.3
End If
End If
SpcF = frm.Width / 61.2244
SpcF = SpcF - clen
If SpcF > 1 Then
DoEvents
frm.Caption = Space(Int(SpcF / 2)) + oldc
Else
frm.Caption = oldc
End If
End Sub
(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
相关内容
- ·如何将数据表导出备份到excel表格
- ·在表中用组合框选择备选项目
- ·如何设置表的Caption和Description属性
- ·用Access实现学校课程表的科学管理
- ·在表中设置美元等货币符号的方法
- ·Access建表需注意的问题(建表原则)
- ·Access获取表下个自动增加的ID值【两种
- ·Access光标在文本框的右边
- ·Access格式、掩码、文本有效性的异同
- ·access中的掩码
- ·【技巧】Access时间函数汇总(一)
- ·Access隐藏表中的列
- ·Excel与Access简便联系方法
- ·Word文本文件导入到Access2007与导出的
- ·ACCESS字段中设置默认日期值函数大全
- ·ACCESS的真假:三、往一个表中插入10万
最新内容
推荐内容