這樣循環(huán)
創(chuàng)新互聯(lián)公司專注于企業(yè)成都全網(wǎng)營(yíng)銷(xiāo)推廣、網(wǎng)站重做改版、回民網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為回民等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
%
Dim numi As Integer
For numi = 1 To TextBox1.Text
%
asp:RadioButton ID="RadioButton%=numi%" runat="server" GroupName="leibie%=numi%" /br /
% next %
''' summary
''' 添加多個(gè)按鈕到一個(gè)容器中.
''' /summary
''' param name="StartPos"所有按鈕開(kāi)始點(diǎn)./param
''' param name="ButtonSize"按鈕的大小./param
''' param name="ButtonSpace"按鈕的間距/param
''' param name="ButtonCount"按鈕的總數(shù)/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("您輸入的數(shù)字無(wú)法解析為數(shù)字.")
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是沒(méi)有backgroundimage屬性的哈,哥。你應(yīng)該是要切換背景的圖片吧,那你應(yīng)該設(shè)置你當(dāng)前主控件的背景圖片哈,而不是button的背景哈。
Private WithEvents NewTextBox As TextBox
'通過(guò)使用WithEvents關(guān)鍵字聲明一個(gè)對(duì)象變量為新的命令按鈕
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這個(gè)API創(chuàng)建一個(gè)命令按鈕
用MoveWindow自動(dòng)這個(gè)按鈕的位置同時(shí)設(shè)置按鈕的大小
用ShowWindow顯示這個(gè)按鈕
DestroyWindow銷(xiāo)毀這個(gè)按鈕