当前位置:编程学习 > VB >>

三维字的实现

 

     使用Windows的API函数DrawState可以轻松实现字体的三维效果。

请看下面的程序:

>>步骤1----建立新工程,在窗体上放置一个CommandButton按钮。

>>步骤2----编写如下代码:

 

Private Const DST_TEXT = &H1

Private Const DSS_DISABLED = &H20

Private Declare Function DrawState Lib "user32" Alias _

    "DrawStateA"(ByVal hDC As Long, ByVal hBrush As Long, _

    ByVal lpDrawStateProc As Long, ByVal lParam As String, _

    ByVal wParam As Long, ByVal n1 As Long, ByVal n2 As _

    Long, ByVal n3 As Long, ByVal n4 As Long, ByVal un As _

    Long) As Long

 

Private Sub Command1_Click()

    Dim FontStr As String

 

    Me.AutoRedraw = True

    FontStr = "本站网址:Majifeng.Top263.net"

    FontSize = 25

    DrawState Me.hDC, 0, 0, FontStr, LenB(StrConv(FontStr, _

        vbFromUnicode)), 10, 80, 0, 0, DST_TEXT Or DSS_DISABLED

    Me.Refresh

End Sub

 

>>步骤3----编译运行,看到效果了吗?

补充:软件开发 , Vb ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,