您现在的位置是:首页 >

vb复选框改变字体 用VB制作三维字体

火烧 2021-11-07 07:08:32 1035
用VB制作三维字体   在用VB制作软件封面和界面时经常要用到三维字体 一般的方法是先用专门的软件(如Xara d等)制作出三维字体的图片 然后再用图片框等控件显示出来 这样虽然简单 但其缺点有二 一

用VB制作三维字体  

  在用VB制作软件封面和界面时经常要用到三维字体 一般的方法是先用专门的软件(如Xara d等)制作出三维字体的图片 然后再用图片框等控件显示出来 这样虽然简单 但其缺点有二 一是要额外增加控件和图片 这样势必会增加程序的大小 二是在VB中图片的加载速度不敢恭维 如能用VB直接编程制作出三维字体 岂不美哉!以下是本人的一点 小技 请笑纳!

  先在VB中新建一个 工程 然后在窗体上放置四个Command 以下是源程序

  先声明如下 通用变量 :

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

  Dim txidth As Integer 文字轮廓宽度

  Dim str As String 欲显示的文字

  Private Sub Command _Click() 显示凸起三维文字

  Dim i As Integer

  str = 显示凸起三维文字

  Me Cls

  Me ForeColor = RGB( )

  For i = To txidth

  Me CurrentX = posx i

  Me CurrentY = posy i

  Me Print str

  Next i

  Me ForeColor = RGB( )

  For i = To txidth

  Me CurrentX = posx + i

  Me CurrentY = posy + i

  Me Print str

  Next i

  Me ForeColor = RGB( )

  Me CurrentX = posx

  Me CurrentY = posy

  Me Print str

  End Sub

  Private Sub Command _Click() 显示凹陷三维文字

  Dim i As Integer

  str = 显示凹陷三维文字

  Me Cls

  Me ForeColor = RGB( )

  For i = To txidth

  Me CurrentX = posx i

  Me CurrentY = posy i

  Me Print str

  Next i

  Me ForeColor = RGB( )

  For i = To txidth

  Me CurrentX = posx + i

  Me CurrentY = posy + i

  Me Print str

  Next i

  Me ForeColor = RGB( )

  Me CurrentX = posx

  Me CurrentY = posy

  Me Print str

  End Sub

  Private Sub Command _Click() 显示阴影三维文字

  str = 显示阴影三维文字

  Me Cls

  Me ForeColor = RGB( )

  Me CurrentX = posx + txidth

  Me CurrentY = posy + txidth

  Me Print str

  Me ForeColor = RGB( )

  Me CurrentX = posx

  Me CurrentY = posy

  Me Print str

  End Sub

  Private Sub Command _Click() 显示倾斜三维文字

vb复选框改变字体 用VB制作三维字体

  Dim i As Integer

  str = 显示倾斜三维文字

  Me Cls

  Me ForeColor = RGB( )

  For i = To txidth

  Me CurrentX = x + i

  Me CurrentY = y + i

  Me Print str

  Next i

  Me ForeColor = RGB( )

  Me CurrentX = posx

  Me CurrentY = posy

  Me Print str

  End Sub

  Private Sub Form_Load()

  posx =

  posy =

  txidth =

  Me FontSize =

lishixinzhi/Article/program/net/201311/11547  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码