您现在的位置是: 软件 > 开发者网络 > 正文
·速成电脑精英(包分配)白领高薪一族从这里开始



-Java套接字编程(下)
-MediaStudio Pro 6.5教程
-三款卸载软件最新试用
-基于Visual C++的Winsock API研究

让标题栏文字居中
2000-06-30· ·-··-

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

■ 相关内容
 利用Form_QueryUnload询问视窗
 使用JavaScript改进你的框架
 Microsoft数据访问组件的再发布
 验证Windows密码
 面向VB编程人员的COM+综述
 模拟MouseEnter,MouseExit事件
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!