VB语言

本类阅读TOP10

·Visual Basic 安装程序的制作!!
·VB中使用EXCEL输出
·一个简单的MP3播放器
·VB程序实现WindowsXP效果的界面!!
·VB打造超酷个性化菜单(六)
·透明位图
·平铺与拉伸MDI窗口的背景图 ~!~
·对《VB程序实现WindowsXP效果的界面》一文的补遗
·从Windows资源管理器中拖动文件
·VB打造超酷个性化菜单(一)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
让标题栏文字居中

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

让标题栏文字居中
|添加以下模块:

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




相关文章

相关软件