本文主要是介绍VB学习第七周--图形打印,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.字母金字塔
Public Class Form1Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPressDim i%Dim s1 As StringLabel1.Text = ""For i = 1 To 10s1 = StrDup(2 * i - 1, Chr(Asc("A") + i - 1))Label1.Text &= Space(20 - i) & s1 & vbCrLfNextEnd SubPrivate Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChangedEnd SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
End Class
2.五角星金字塔
Public Class Form1Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPressDim i%Dim s1 As StringLabel1.Text = ""For i = 1 To 10s1 = StrDup(2 * i - 1, "☆")Label1.Text &= Space(20 - 2 * i) & s1 & vbCrLfNextEnd SubPrivate Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChangedEnd SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
End Class
3.数字倒金字塔
Public Class Form1Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPressIf Asc(e.KeyChar) = 13 ThenDim i, j, n As Integern = TextBox1.TextLabel1.Text = ""For i = 1 To nLabel1.Text &= Space(i)For j = 1 To 2 * (n - i) + 1Label1.Text &= iNextLabel1.Text &= vbCrLfNextEnd IfEnd SubPrivate Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChangedEnd SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
End Class
这篇关于VB学习第七周--图形打印的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!