VB.NET 2010 / WinForms の使用
「Panel1」という名前のパネルがあり、そのパネル内に 3 つのボタンがあります。フォームの読み込みイベントで、小さな赤い四角を作成していて、その赤い四角を 3 つのボタンのそれぞれに配置したいと考えています...
Dim RedSquare As New Panel
With RedSquare
.Top = 0
.Left = 0
.Width = 10
.Height = 10
.BackColor = Color.Red
End With
For Each Control As Control In Panel1.Controls
If TypeOf Control Is Button Then
Control.Controls.Add(RedSquare)
End If
Next
ただし、小さな赤い四角は最初のボタンの内側にのみ表示されます。
私は何を間違っていますか?