以Textbox为例说明,其余控件方法类似:
1.Vb中控件一般都是默认文字左对齐的
2.设置“Alignment”属性为2-Center
3.则文字就实现居中对齐了
print是VB的最基本的显示文本命令,无法实现对显示文字的精细控制,如果你想得到完美的显示效果,就要用到控件了。如果非要用Print,那就只能用笨办法了:
Private Sub Form_click()
Cls
Print Tab(49); "九九乘法表"
Print String(108, "-")
For i = 1 To 9
For j = 1 To i
Print Tab((j - 1) * 12 + 1); ; i; "*"; j; "="; i * j;
Next j
Print
Next i
End Sub
Private Sub Form_click()
Print Tab(49); "九九乘法表"
Print String(108, "-")
For i = 1 To 9
For j = 1 To i
Print Tab((j - 1) * 12 + 1); ; i; "*"; j; "="; i * j;
Next j
Print
Next i
End Sub
Private Sub Command1_Click()
Print Tab(50); "九九乘法表"
Print ; "-----------------------------------------------------------------------------------------------------------"
For i = 1 To 9
For j = 1 To i
Print Tab((j - 1) * 12 + 1); ; i; "*"; j; "="; i * j;
Next j
Print
Next i
End Sub
为什么一定要全在窗口上打印出来
用标签帮助方便得多