这样循环
创新互联公司专注于企业成都全网营销推广、网站重做改版、回民网站定制设计、自适应品牌网站建设、成都h5网站建设、电子商务商城网站建设、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为回民等各大城市提供网站开发制作服务。
%
Dim numi As Integer
For numi = 1 To TextBox1.Text
%
asp:RadioButton ID="RadioButton%=numi%" runat="server" GroupName="leibie%=numi%" /br /
% next %
''' summary
''' 添加多个按钮到一个容器中.
''' /summary
''' param name="StartPos"所有按钮开始点./param
''' param name="ButtonSize"按钮的大小./param
''' param name="ButtonSpace"按钮的间距/param
''' param name="ButtonCount"按钮的总数/param
''' param name="AddingContainer"被添加到的容器/param
''' remarks/remarks
Private Sub AddButtons(ByVal StartPos As Point, ByVal ButtonSize As Size, _
ByVal ButtonSpace As Size, ByVal ButtonCount As Integer, _
ByVal AddingContainer As Control)
Dim mBtnPos As Point = StartPos
For ItemTemp As Integer = 0 To ButtonCount - 1
Dim NewButton As Button = New Button() With
mBtnPos.Y += ButtonSpace.Height + ButtonSize.Height
If mBtnPos.Y AddingContainer.Height Then
mBtnPos.Y = StartPos.Y
mBtnPos.X += ButtonSpace.Width + ButtonSize.Width
End If
NewButton.Text = String.Format(":", CStr(ItemTemp + 1))
AddHandler NewButton.Click, AddressOf btnzh_Click
AddingContainer.Controls.Add(NewButton)
Next
End Sub
Private Sub btnzh_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzh.Click
Dim ItemCount As Integer = 0
Try
ItemCount = CInt(txtChoice.Text)
Catch ex As Exception
MessageBox.Show("您输入的数字无法解析为数字.")
Return
End Try
AddButtons(New Point(2, 2), New Size(60, 40), New Size(20, 30), ItemCount, Me)
End Sub
Private Sub btnzh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
button是没有backgroundimage属性的哈,哥。你应该是要切换背景的图片吧,那你应该设置你当前主控件的背景图片哈,而不是button的背景哈。
Private WithEvents NewTextBox As TextBox
'通过使用WithEvents关键字声明一个对象变量为新的命令按钮
Private Sub Command1_Click()
If NewTextBox Is Nothing Then
Set NewTextBox = Controls.Add("VB.TextBox", "cmdNew", Form1)
NewTextBox.Move 200, 200
NewTextBox.Width = Form1.Width - 450
NewTextBox.Height = Form1.Height - 1400
NewTextBox.Visible = True
End If
End Sub
Private Sub Command2_Click()
If NewTextBox Is Nothing Then
Exit Sub
Else
Controls.Remove NewTextBox
Set NewTextBox = Nothing
End If
End Sub
用CreateWindow这个API创建一个命令按钮
用MoveWindow自动这个按钮的位置同时设置按钮的大小
用ShowWindow显示这个按钮
DestroyWindow销毁这个按钮