听说要什么HDC,GDI函数等的,但具体要怎样做呢?谢谢

解决方案 »

  1.   

    FORM1.CURRENTX = 这里写X座标
    FORM1.CURRENTY = 这里写Y座标
    FORM1.PRINT "你想写什么就写什么"
      

  2.   

    在用VB制作软件封面和界面时经常要用到三维字体,一般的方法是先用专门的软件(如Xara3d等)制作出三维字体的图片,然后再用图片框等控件显示出来。这样虽然简单,但其缺点有二:一是要额外增加控件和图片,这样势必会增加程序的大小;二是在VB中图片的加载速度不敢恭维。如能用VB直接编程制作出三维字体,岂不美哉!以下是本人的一点“小技”,请笑纳!
    先在VB中新建一个“工程”,然后在窗体上放置四个Command。以下是源程序:
    先声明如下“通用变量”:
    Dim posx, posy As Integer           '文字的显示位置
    Dim txtwidth As Integer             '文字轮廓宽度
    Dim str As String                       '欲显示的文字Private Sub Command1_Click()       '显示凸起三维文字
        Dim i As Integer
            
        str = "显示凸起三维文字"
        Me.Cls
        
        Me.ForeColor = RGB(255, 255, 255)
        For i = 1 To txtwidth
            Me.CurrentX = posx - i
            Me.CurrentY = posy - i
            Me.Print str
        Next i
        
        Me.ForeColor = RGB(0, 0, 0)
        For i = 1 To txtwidth
            Me.CurrentX = posx + i
            Me.CurrentY = posy + i
            Me.Print str
        Next i
        
        Me.ForeColor = RGB(0, 0, 255)
        Me.CurrentX = posx
        Me.CurrentY = posy
        Me.Print strEnd Sub
    Private Sub Command2_Click()       '显示凹陷三维文字
        Dim i As Integer
            
        str = "显示凹陷三维文字"
        Me.Cls
        
        Me.ForeColor = RGB(0, 0, 0)
        For i = 1 To txtwidth
            Me.CurrentX = posx - i
            Me.CurrentY = posy - i
            Me.Print str
        Next i
        
        Me.ForeColor = RGB(255, 255, 255)
        For i = 1 To txtwidth
            Me.CurrentX = posx + i
            Me.CurrentY = posy + i
            Me.Print str
        Next i
        
        Me.ForeColor = RGB(0, 0, 255)
        Me.CurrentX = posx
        Me.CurrentY = posy
        Me.Print str
    End SubPrivate Sub Command3_Click()        '显示阴影三维文字
        str = "显示阴影三维文字"
        Me.Cls
            
        Me.ForeColor = RGB(100, 100, 100)
        Me.CurrentX = posx + txtwidth
        Me.CurrentY = posy + txtwidth
        Me.Print str
        
        Me.ForeColor = RGB(0, 0, 255)
        Me.CurrentX = posx
        Me.CurrentY = posy
        Me.Print str
    End Sub 
    Private Sub Command4_Click()          '显示倾斜三维文字
        Dim i As Integer
            
        str = "显示倾斜三维文字"
        Me.Cls
        
        Me.ForeColor = RGB(100, 100, 100)
        For i = 1 To txtwidth
            Me.CurrentX = x + i
            Me.CurrentY = y + i
            Me.Print str
        Next i
        
        Me.ForeColor = RGB(0, 0, 255)
        Me.CurrentX = posx
        Me.CurrentY = posy
        Me.Print str
    End SubPrivate Sub Form_Load()
        posx = 100
        posy = 100
        txtwidth = 50
        Me.FontSize = 30
    End Sub
      

  3.   

    加,号可以让他们之间有较大的空隙
    Print "a", "b"
    加;号则是紧跟其后
    Print "a"; "b"
      

  4.   

    Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Sub Form_Load()
        Me.AutoRedraw = True
        FontSize = 14
        TextOut Me.hdc, 12, 2, "this is line 1", Len("this is line 1")
        
        FontSize = 18
        TextOut Me.hdc, 12, 20, "this is line 2", Len("this is line 2")
    End Sub