失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > html标题栏显示文字居中 让标题栏文字居中

html标题栏显示文字居中 让标题栏文字居中

时间:2020-02-13 07:13:45

相关推荐

html标题栏显示文字居中 让标题栏文字居中

下载本文示例代码

p>|添加以下模块:

PublicSubCenterC(frmAsForm)

DimSpcFAsIntegerHowmanyspacescanfit

DimclenAsIntegercaptionlength

DimoldcAsStringoldcaption

DimiAsIntegernotimportant

removeanyspacesattheendsofthecaption

veryeasyifyoureaditcarefully

oldc=frm.Caption

DoWhileLeft(oldc,1)=Space(1)

DoEvents

oldc=Right(oldc,Len(oldc)-1)

Loop

DoWhileRight(oldc,1)=Space(1)

DoEvents

oldc=Left(oldc,Len(oldc)-1)

Loop

clen=Len(oldc)

IfInStr(oldc,"!")$#@60;$#@62;0Then

IfInStr(oldc,"")$#@60;$#@62;0Then

clen=clen*1.5

Else

clen=clen*1.4

EndIf

Else

IfInStr(oldc,"")$#@60;$#@62;0Then

clen=clen*1.4

Else

clen=clen*1.3

EndIf

EndIf

seehowmanycharacterscanfit

SpcF=frm.Width/61.2244howmanyspacecanfit

itthecaption

SpcF=SpcF-clenHowmanyspacescanfit-Howmuch

spacethe

tiontakesup

Nowthetrickypart

IfSpcF$#@62;1Then

DoEventsspeeduptheprogram

frm.Caption=Space(Int(SpcF/2)) oldc

Elseiftheformistoosmallforspaces

frm.Caption=oldc

EndIf

EndSub

|在窗体中添加以下代码:

DimoldsizeAsLong

PrivateSubForm_Resize()

IfMe.Width=oldsizeThenifthewidthhasnt

changed

ExitSubthendontmesswithit

Else

CenterCMe

oldsize=Me.Width

EndIf

EndSub

PrivateSubForm_Load()

CenterCMe

oldsize=Me.Width

EndSub

p>|添加以下模块:

PublicSubCenterC(frmAsForm)

DimSpcFAsIntegerHowmanyspacescanfit

DimclenAsIntegercaptionlength

DimoldcAsStringoldcaption

DimiAsIntegernotimportant

removeanyspacesattheendsofthecaption

veryeasyifyoureaditcarefully

oldc=frm.Caption

DoWhileLeft(oldc,1)=Space(1)

DoEvents

oldc=Right(oldc,Len(oldc)-1)

Loop

DoWhileRight(oldc,1)=Space(1)

DoEvents

oldc=Left(oldc,Len(oldc)-1)

Loop

clen=Len(oldc)

IfInStr(oldc,"!")$#@60;$#@62;0Then

IfInStr(oldc,"")$#@60;$#@62;0Then

clen=clen*1.5

Else

clen=clen*1.4

EndIf

Else

IfInStr(oldc,"")$#@60;$#@62;0Then

clen=clen*1.4

Else

clen=clen*1.3

EndIf

EndIf

seehowmanycharacterscanfit

SpcF=frm.Width/61.2244howmanyspacecanfit

itthecaption

SpcF=SpcF-clenHowmanyspacescanfit-Howmuch

spacethe

tiontakesup

Nowthetrickypart

IfSpcF$#@62;1Then

DoEventsspeeduptheprogram

frm.Caption=Space(Int(SpcF/2)) oldc

Elseiftheformistoosmallforspaces

frm.Caption=oldc

EndIf

EndSub

|在窗体中添加以下代码:

DimoldsizeAsLong

PrivateSubForm_Resize()

IfMe.Width=oldsizeThenifthewidthhasnt

changed

ExitSubthendontmesswithit

Else

CenterCMe

oldsize=Me.Width

EndIf

EndSub

PrivateSubForm_Load()

CenterCMe

oldsize=Me.Width

EndSub

下载本文示例代码

让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中让标题栏文字居中

阅读(14) | 评论(0) | 转发(0) |

如果觉得《html标题栏显示文字居中 让标题栏文字居中》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。