用VB将1 2 3 4 5 6数组组成1 2 3 4 5 6六个数字 表示如下

2024-12-16 19:38:57
推荐回答(3个)
回答1:

设置窗体autoredraw属性为true,窗体上放一个按钮和一个文本框(用于输入数字),代码:
Private Sub Command1_Click()
Dim j As Integer
Cls
nu = Trim(Text1.Text)
nul = Len(nu)
For i = 0 To nul - 1
j = Mid(nu, i + 1, 1)
Call numtable(j, 10 * i)
CurrentY = 0
Next
End Sub
Private Sub numtable(num As Integer, spa As Integer)
Select Case num
Case 1
Print Space(spa); "11"; vbCrLf; Space(spa); "11"; vbCrLf; Space(spa); "11"; vbCrLf; Space(spa); "11"; vbCrLf; Space(spa); "11"; vbCrLf;
Case 2
Print Space(spa); "22222"; vbCrLf; Space(spa); " 22"; vbCrLf; Space(spa); "22222"; vbCrLf; Space(spa); "22 "; vbCrLf; Space(spa); "22222"; vbCrLf;
Case 3
Print Space(spa); "33333"; vbCrLf; Space(spa); " 33"; vbCrLf; Space(spa); "33333"; vbCrLf; Space(spa); " 33"; vbCrLf; Space(spa); "33333"; vbCrLf;
Case 4
Print Space(spa); " 4444"; vbCrLf; Space(spa); "44 44"; vbCrLf; Space(spa); "44444"; vbCrLf; Space(spa); " 44"; vbCrLf; Space(spa); " 44"; vbCrLf;
Case 5
Print Space(spa); "55555"; vbCrLf; Space(spa); "55 "; vbCrLf; Space(spa); "55555"; vbCrLf; Space(spa); " 55"; vbCrLf; Space(spa); "55555"; vbCrLf;
Case 6
Print Space(spa); "66666"; vbCrLf; Space(spa); "66 "; vbCrLf; Space(spa); "66666"; vbCrLf; Space(spa); "66 66"; vbCrLf; Space(spa); "66666"; vbCrLf;
End Select
End Sub

回答2:

If Text1.Text = 1 Then
Text2.Text = Text1.Text & Text1.Text
ElseIf Text1.Text = 2 Then
Text2.Text = Text1.Text & Text1.Text & Text1.Text & Text1.Text & Text1.Text
ElseIf Len(Text1.Text) = 2 Then
Text2.Text = Mid(Text1.Text, 1, 1) & Mid(Text1.Text, 1, 1) & Mid(Text1.Text, 2, 1) & Mid(Text1.Text, 2, 1)
End If自己试一下是不是你想要的结果

回答3:

没有看出有什么规律