VB6.0 怎么在Picture1里 Print 特殊字符?Picture1里 Print ☏☎   显示?? 我用forms 2.0 的TextBox2 可以显示,但2.0 没有Picture 控件我是想用Picture1里 Print 字符来取点阵,其他字符已经完成,但 特殊字符不能显示。忘高手帮忙

解决方案 »

  1.   

    找它的asc码。
    eg:
    Dim i%
    For i = 0 To 20
        Picture1.Print Chr(i)
    Next
      

  2.   

    使用TextOutW,比如以下代码将在窗口上显示☏☎字符。Private Declare Function TextOutW Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As LongPrivate Sub Form_Load()
        Dim strText As String
        
        strText = ChrW(9742) + ChrW(9743) + vbNullChar
        
        Me.AutoRedraw = True
        TextOutW Me.hdc, 10, 10, StrPtr(strText), 2
    End Sub
      

  3.   

    放一个文本框。一个按钮。
    编写如下代码:
    MsgBox Asc(textBox1.Text)
    可以获得内码,再写到程序里面。
      

  4.   


    江南春 你好 用你方法 可以再Picture 里打印特殊字符, 但现在又有一个问题  希望可以解答
    Picture2.TextWidth(StrPtr(TextBox2.Text))   用StrPtr函数后 Picture2.TextWidth只能输出 小于42 这是什么原因
      

  5.   


    Private Type Size
            cx As Long
            cy As Long
    End Type
    Private Declare Function TextOutW Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
    Private Declare Function GetTextExtentPoint32W Lib "gdi32" (ByVal hdc As Long, ByVal lpsz As Long, ByVal cbString As Long, lpSize As Size) As Long
    Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As LongPrivate Sub Form_Load()
        Dim strText As String, nLen As Long, sizeText As Size
        
        strText = ChrW(9742) + ChrW(9743) + vbNullChar
        '获得字符串长度
        nLen = lstrlenW(StrPtr(strText))
        '在窗口中显示字符串
        Me.AutoRedraw = True
        TextOutW Me.hdc, 10, 10, StrPtr(strText), nLen
        '获得字符串像素级宽度
        GetTextExtentPoint32W Me.hdc, StrPtr(strText), nLen, sizeText
        Debug.Print sizeText.cx
    End Sub
      

  6.   

    来一个歪的Option Explicit
    Private Const SRCAND = &H8800C6
    Private Const SRCCOPY = &HCC0020
    Private Const SRCDECIMALBIND = 19
    Private Const SRCERASE = &H440328
    Private Const SRCPAINT = &HEE0086Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Command1_Click()
        Dim lngP As Long
        lngP = BitBlt(Picture1.hDC, 0, 0, TextBox1.Width / 2, TextBox1.Height / 2, Me.hDC, TextBox1.Left + 5, TextBox1.Top + 2, SRCAND)
    End SubPrivate Sub Form_Load()
        TextBox1.Text = ChrW(9742) + ChrW(9743)
        Picture1.ScaleMode = 3
        Me.ScaleMode = 3
    End Sub
    该例子使用了Forms2.0的TextBox控件。
      

  7.   

    来一个歪的Option Explicit
    Private Const SRCAND = &H8800C6
    Private Const SRCCOPY = &HCC0020
    Private Const SRCDECIMALBIND = 19
    Private Const SRCERASE = &H440328
    Private Const SRCPAINT = &HEE0086Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Command1_Click()
        Dim lngP As Long
        lngP = BitBlt(Picture1.hDC, 0, 0, TextBox1.Width / 2, TextBox1.Height / 2, Me.hDC, TextBox1.Left + 5, TextBox1.Top + 2, SRCAND)
    End SubPrivate Sub Form_Load()
        TextBox1.Text = ChrW(9742) + ChrW(9743)
        Picture1.ScaleMode = 3
        Me.ScaleMode = 3
    End Sub
    该例子使用了Forms2.0的TextBox控件。
      

  8.   

    使用SetTextCharacterExtra设置字符间距。Private Type Size
            cx As Long
            cy As Long
    End Type
    Private Declare Function TextOutW Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
    Private Declare Function GetTextExtentPoint32W Lib "gdi32" (ByVal hdc As Long, ByVal lpsz As Long, ByVal cbString As Long, lpSize As Size) As Long
    Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
    Private Declare Function SetTextCharacterExtra Lib "gdi32" (ByVal hdc As Long, ByVal nCharExtra As Long) As LongPrivate Sub Form_Load()
        Dim strText As String, nLen As Long, sizeText As Size
        
        Me.AutoRedraw = True
        
        strText = ChrW(9742) + ChrW(9743) + vbNullChar
        '获得字符串长度
        nLen = lstrlenW(StrPtr(strText))
        '设置字间距
        SetTextCharacterExtra Me.hdc, 20
        '在窗口中显示字符串
        TextOutW Me.hdc, 10, 10, StrPtr(strText), nLen
        '获得字符串像素级宽度
        GetTextExtentPoint32W Me.hdc, StrPtr(strText), nLen, sizeText
        Debug.Print sizeText.cx
    End Sub