电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

用VB制作三维字体


发布日期:2021/1/15
 

在用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

上一篇:总结MasterPage中的资源文件引用路径

下一篇:采集网页图片代码