一个把字符串加密成图像的软件,出错了(正解+100分)

2025-02-23 16:49:48
推荐回答(1个)
回答1:

Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Command1_Click()
Dim x As Long
For i = 1 To Len(Text1.Text)
x = Asc(Mid(Text1.Text, i, 1))
If x > 0 And x <= 126 Then
Picture1.PSet (x, i), vbRed
End If
Next
End Sub
Private Sub Command4_Click()
Dim x As Long, y As Long
For y = 1 To 1000
For x = 1 To 126
a = GetPixel(Me.Picture1.hdc, x, y)
If a = vbRed Then
s = s & Chr(x)
End If
Next
Next
MsgBox s
End Sub