| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 709 人关注过本帖
标题:那位高手有空能帮解释下这个程序吗! 不了解呀
只看楼主 加入收藏
q317340777
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-10-30
收藏
 问题点数:0 回复次数:2 
那位高手有空能帮解释下这个程序吗! 不了解呀
End Function
Private Function Hex2(c As String) As String
    Hex2 = Hex(c)
    If Len(Hex2) < 2 Then
        Hex2 = "0" & Hex2
    End If
End Function
Private Sub txtTextOut_LostFocus()
    Dim c As String
    Dim i As Long
    Dim Temp As Long
    OutputString = ""
    If (OutputAscii) Then
        For i = 1 To Len(txtTextOut.Text)
            c = Mid(txtTextOut.Text, i, 1)
            If (c = "\") Then
                i = i + 1
                c = Mid(txtTextOut.Text, i, 1)
                Select Case c
                    Case "b"
                        OutputString = OutputString & Chr(8)
                    Case "t"
                        OutputString = OutputString & Chr(9)
                    Case "n"
                        OutputString = OutputString & Chr(10)
                    Case "r"
                        OutputString = OutputString & Chr(13)
                    Case "\"
                        OutputString = OutputString & "\"
                    Case "x"
                        c = HexChar(Mid(txtTextOut.Text, i + 1, 1)) * 16 _
                                        + HexChar(Mid(txtTextOut.Text, i + 2, 1))
                        OutputString = OutputString & Chr(c)
                        i = i + 2
                End Select
            Else
                OutputString = OutputString & c
            End If
        Next i
   
        txtTextOut.Text = ""
        For i = 1 To Len(OutputString)
            c = Mid(OutputString, i, 1)
            txtTextOut.Text = txtTextOut.Text & AsciiRep(c)
        Next i
    Else
        i = 1
        Do While (Len(Mid(txtTextOut.Text, i)) > 0)
            Temp = 0
            Do While (Mid(txtTextOut.Text, i, 1)) = " "
                i = i + 1
            Loop
            c = Mid(txtTextOut.Text, i, 1)
            Do While Not (c = " " Or c = "")
                Temp = (Temp * 16) + HexChar(c)
                i = i + 1
                c = Mid(txtTextOut.Text, i, 1)
            Loop
            If (Temp > 255) Then
                Temp = 0
            End If
            OutputString = OutputString & Chr(Temp)
        Loop
        
        txtTextOut.Text = ""
        For i = 1 To Len(OutputString)
            c = Mid(OutputString, i, 1)
            txtTextOut.Text = txtTextOut.Text & " " & AsciiRep(c)
        Next i
    End If
    txtTextOut.SelStart = Len(txtTextOut.Text)
   
End Sub
搜索更多相关主题的帖子: txtTextOut String 
2007-12-06 17:04
q317340777
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-10-30
收藏
得分:0 
回复 1# 的帖子
详细点就更好了!
2007-12-06 17:05
wjputi
Rank: 2
等 级:论坛游民
帖 子:14
专家分:22
注 册:2007-12-11
收藏
得分:0 
诈看是10进制转换16进制的代码
2007-12-11 11:48
快速回复:那位高手有空能帮解释下这个程序吗! 不了解呀
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029732 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved