熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

用VB制作三維字體

2022-06-13   來源: .NET編程 

  在用VB制作軟件封面和界面時經常要用到三維字體一般的方法是先用專門的軟件(如Xarad等)制作出三維字體的圖片然後再用圖片框等控件顯示出來這樣雖然簡單但其缺點有二一是要額外增加控件和圖片這樣勢必會增加程序的大小二是在VB中圖片的加載速度不敢恭維如能用VB直接編程制作出三維字體豈不美哉!以下是本人的一點小技請笑納!

  先在VB中新建一個工程然後在窗體上放置四個Command以下是源程序

  先聲明如下通用變量:

  Dim posx posy As Integer 文字的顯示位置

  Dim txtwidth As Integer 文字輪廓寬度

  Dim str As String 欲顯示的文字

  Private Sub Command_Click() 顯示凸起三維文字

  Dim i As Integer

  str = 顯示凸起三維文字

  MeCls

  MeForeColor = RGB( )

  For i = To txtwidth

  MeCurrentX = posx i

  MeCurrentY = posy i

  MePrint str

  Next i

  MeForeColor = RGB( )

  For i = To txtwidth

  MeCurrentX = posx + i

  MeCurrentY = posy + i

  MePrint str

  Next i

  MeForeColor = RGB( )

  MeCurrentX = posx

  MeCurrentY = posy

  MePrint str

  End Sub

  Private Sub Command_Click() 顯示凹陷三維文字

  Dim i As Integer

  str = 顯示凹陷三維文字

  MeCls

  MeForeColor = RGB( )

  For i = To txtwidth

  MeCurrentX = posx i

  MeCurrentY = posy i

  MePrint str

  Next i

  MeForeColor = RGB( )

  For i = To txtwidth

  MeCurrentX = posx + i

  MeCurrentY = posy + i

  MePrint str

  Next i

  MeForeColor = RGB( )

  MeCurrentX = posx

  MeCurrentY = posy

  MePrint str

  End Sub

  Private Sub Command_Click() 顯示陰影三維文字

  str = 顯示陰影三維文字

  MeCls

  MeForeColor = RGB( )

  MeCurrentX = posx + txtwidth

  MeCurrentY = posy + txtwidth

  MePrint str

  MeForeColor = RGB( )

  MeCurrentX = posx

  MeCurrentY = posy

  MePrint str

  End Sub

  Private Sub Command_Click() 顯示傾斜三維文字

  Dim i As Integer

  str = 顯示傾斜三維文字

  MeCls

  MeForeColor = RGB( )

  For i = To txtwidth

  MeCurrentX = x + i

  MeCurrentY = y + i

  MePrint str

  Next i

  MeForeColor = RGB( )

  MeCurrentX = posx

  MeCurrentY = posy

  MePrint str

  End Sub

  Private Sub Form_Load()

  posx =

  posy =

  txtwidth =

  MeFontSize =

  End Sub


From:http://tw.wingwit.com/Article/program/net/201311/11547.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.