vb:如何在文本框中用星号打印等腰三角形???
PrivateSubText1_Click()DimiAsIntegerDimjAsIntegerFori=1To10Text1.Text=Space(12-i)&Tex...
Private Sub Text1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To 10
Text1.Text = Space(12 - i) & Text1.Text
For j = 1 To i
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
End Sub
在三角形左边加空格只有第一行成功,无语。。。 展开
Dim i As Integer
Dim j As Integer
For i = 1 To 10
Text1.Text = Space(12 - i) & Text1.Text
For j = 1 To i
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
End Sub
在三角形左边加空格只有第一行成功,无语。。。 展开
3个回答
展开全部
Dim i As Integer
Dim j As Integer
For i = 1 To 10
Text1.Text = Text1.Text & Space(12 - i) '关键在于这一句
For j = 1 To i
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
Dim j As Integer
For i = 1 To 10
Text1.Text = Text1.Text & Space(12 - i) '关键在于这一句
For j = 1 To i
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Text1_Click()
Dim i As Integer
Dim j As Integer
Text1.Text = ""
For i = 1 To 10
Text1.Text = Text1.Text & Space(10 - i)
For j = 1 To (i - 1) * 2 + 1
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
End Sub
Dim i As Integer
Dim j As Integer
Text1.Text = ""
For i = 1 To 10
Text1.Text = Text1.Text & Space(10 - i)
For j = 1 To (i - 1) * 2 + 1
Text1.Text = Text1.Text & "*"
Next j
Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
初始化是把文本框清空 text1.text=“”
你把文本框的Mutiline属性 改成true
你把文本框的Mutiline属性 改成true
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询