vb中的图片框中如何显示一个矩阵
图片框和表单都属于窗体类型的容器,都有print方法用来进行文本输出,但由于显示机制问题,用print方法会有很多的麻烦,您可以在里面添加一个文本框或者label,在显示时可以这样写
label1。 caption="字符"
其中换行符可用vbnewline表示。
在其中输出一个如下矩阵a(3,4),如
1 0 1 1
0 1 1 1
0 1 1 0
0 0 0 1
1 1 1 1
就可以这样写程序
dim strTmp as string
label1。 caption=""
for i=0 to 4
for j=0 to 3
strtmp=strtmp & " " & a(j,i)...全部
图片框和表单都属于窗体类型的容器,都有print方法用来进行文本输出,但由于显示机制问题,用print方法会有很多的麻烦,您可以在里面添加一个文本框或者label,在显示时可以这样写
label1。
caption="字符"
其中换行符可用vbnewline表示。
在其中输出一个如下矩阵a(3,4),如
1 0 1 1
0 1 1 1
0 1 1 0
0 0 0 1
1 1 1 1
就可以这样写程序
dim strTmp as string
label1。
caption=""
for i=0 to 4
for j=0 to 3
strtmp=strtmp & " " & a(j,i) '依次赋值到strtmp变量中
next
strtmp=strtmp & vbnewline '插入换行
next
label1。
caption = strtmp
如果用文本框可以改成text1。text=strtmp
如果用print可以写成picture1。print strtmp
用label最大的好处是可以移动文字。
收起