| 网站首页 | 新闻 | 新书 | 专家 | 技巧 | 源码作品 | 工具/资源 | 商城 | 风采 | 留言 | 论坛 | 网址 | 承接 | 
您现在的位置: Access/Office中国 >> 技巧 >> Access >>  >> 文章正文 用户登录 新用户注册
让标题栏文字置中         ★★★
让标题栏文字置中
作者:想不通 文章来源:ACCESS设计在线 点击数: 本日:{$DayHits} 更新时间:2006-11-24 23:49:00
文章正文:
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
文章录入:tm    责任编辑:tm 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    专 题 栏 目
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    没有相关文章
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)