投稿日 | : 2003/10/24(Fri) 11:39 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: う〜ん |
> ちょっとよくわからないのですが、ボタンの配列ってことですか?
この掲示板のNo.5999の投稿を見て下さい。
Form 上に CommandButtonを1個貼付け、プロパティウィンドウの
Indexプロパティを0に設定して下さい。
そして書きコードをペーストして試して見て下さい。
Option Explicit
Private Sub Form_Load()
Dim i As Long
'Command1(0) の下に新たにCommandButtonが3個配置されます。
For i = 1 To 3
Load Command1(i)
Command1(i).Move Command1(0).Left, (i * 500) + Command1(0).Top, Command1(0).Width, Command1(0).Height
Command1(i).Visible = True
Next i
End Sub
Private Sub Command1_Click(Index As Integer)
Dim i As Long
If Index = 2 Then
'Command1(2) をクリックすると横幅が広くなります
For i = 0 To 3
Command1(i).Width = Command1(i).Width * 1.2
Next i
ElseIf Index = 3 Then
'Command1(3) をクリックすると横幅が狭くなります
For i = 0 To 3
Command1(i).Width = Command1(i).Width * 0.8
Next i
End If
End Sub