VB问题:如何用Print方法显示在PictureBox控件上的内容自动换行???

来源:百度知道 编辑:UC知道 时间:2024/05/09 03:39:23
我用inputbox录入数据后,用pint方法显示在PictureBox控件上,但它只能横排显示,由于控件宽度有限,后面的无法在第二排出现。请帮忙解决如何能自动换行显示!我用的代码是:
Private Sub Command1_Click()

ff:

a(i) = InputBox("请录数据!", "", " ")
If a(i) = "" Then Exit Sub
If a(i) = " " Then MsgBox "还没输入!": GoTo ff

If a(i) > 100 Then a34003 = MsgBox("数据为空或越界,请重新输入", vbOKOnly): GoTo ff
If Not IsNumeric(a(i)) Then MsgBox "请录入数字!": GoTo ff
Picture1.Print a(i) + "\";
Next i

End Sub
前面少写了一句代码:
for i=1 to 60

对于一楼的回答,那样只能一行显示一个数字啊!不好不好!

试下这个
(你的for循环不知是放在哪里的)
-------
调试了下你的程序 发现不少问题
改成这样了 应该没什么Bug了
使用数据时 可用b(60)数组
a(60)只为测试是否符合要求
其中调整处你体会下:

Private Sub Command1_Click()
Dim a(60) As String
Dim b(60) As Double
For i = 1 To 60
ff:

a(i) = InputBox("请录数据!", "", " ")
If a(i) = "" Then Exit Sub
If a(i) = " " Then MsgBox "还没输入!": GoTo ff

If Not IsNumeric(a(i)) Then MsgBox "请录入数字!": GoTo ff
If CDbl(a(i)) > 100 Then a34003 = MsgBox("数据为空或越界,请重新输入", vbOKOnly): GoTo ff

Picture1.Print a(i) + "\";

If i Mod 10 = 0 Then '每行显示十个数后 ,换行
Picture1.Print
End If '

Next i

For i = 1 To 60
b(i) = CDbl(a(i))
Next
End Sub

你打开inputbox录入数据后,用pint方法显示在PictureBox控件上

你应该去调试他的代码
完后用代码进行RPT的无代码超做!
这样他才能自动换行!

你的代码好奇怪啊!
f