讓標題欄文字居中
發表于:2007-05-25來源:作者:點擊數:
標簽:標題欄居中文字
讓標題欄文字居中 |添加以下模塊: PublicSubCenterC(frmAsForm) DimSpcFAsInteger'Howmanyspacescanfit DimclenAsInteger'captionlength DimoldcAsString'oldcaption DimiAsInteger'notimport ant 'removeanyspacesattheendsofthecaption 'veryeasyifyourea
讓標題欄文字居中
|添加以下模塊:
PublicSubCenterC(frmAsForm)
DimSpcFAsInteger'Howmanyspacescanfit
DimclenAsInteger'captionlength
DimoldcAsString'oldcaption
DimiAsInteger'notimportant
'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,"!")<>0Then
IfInStr(oldc,"")<>0Then
clen=clen*1.5
Else
clen=clen*1.4
EndIf
Else
IfInStr(oldc,"")<>0Then
clen=clen*1.4
Else
clen=clen*1.3
EndIf
EndIf
''seehowmanycharacterscanfit
SpcF=frm.Width/61.2244'howmanyspacecanfit itthecaption
SpcF=SpcF-clen'Howmanyspacescanfit-Howmuch spacethe
'captiontakesup
''Nowthetrickypart
IfSpcF>1Then
DoEvents'speeduptheprogram
frm.Caption=Space(Int(SpcF/2))+oldc
Else'iftheformistoosmallforspaces
frm.Caption=oldc
EndIf
EndSub
|在窗體中添加以下代碼:
DimoldsizeAsLong
PrivateSubForm_Resize()
IfMe.Width=oldsizeThen'ifthewidthhasn't changed
ExitSub'thendontmesswithit
Else
CenterCMe
oldsize=Me.Width
EndIf
EndSub
PrivateSubForm_Load()
CenterCMe
oldsize=Me.Width
EndSub
原文轉自:http://www.kjueaiud.com
老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月
|