vb 2010의 여러 행에 그림 상자를 만드는 방법을 모르겠습니다. 지금은 에 한 행과 그림 상자 만 만들 수 있습니다. 두 번째 행. 나는 다음과 코드를 사용했다 (결국 나는 각 행에 10 pictureboxes과 5 행에 추가하고 싶습니다) :vb 2010의 행에 그림 상자를 추가하는 방법
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xPosition As Integer = 20
Dim yPosition As Integer = 40
For i As Integer = 1 To 20
Dim pb As New PictureBox
With pb
If i < 20 Then
.Name = "PictureBox" & i.ToString
.SizeMode = PictureBoxSizeMode.Zoom
.Size = New Size(60, 60)
.Location = New Point(xPosition, yPosition)
.Image = My.Resources.Seating_No_Person
Me.Controls.Add(pb)
AddHandler pb.Click, AddressOf PictureBox_Click
xPosition += 70
ElseIf i > 10 Then
.Name = "PictureBox" & i.ToString
.SizeMode = PictureBoxSizeMode.Zoom
.Size = New Size(60, 60)
.Location = New Point(20, 120)
.Image = My.Resources.Seating_No_Person
Me.Controls.Add(pb)
AddHandler pb.Click, AddressOf PictureBox_Click
xPosition += 70
End If
Dim thisSeating As New Seating
With thisSeating
.SeatNumber = i
.PB = pb
.Occupied = False
End With
seatingList.Add(thisSeating)
End With
Next
End Sub
하는 사람이 나를 도와하거나 올바른 경로로 저를 지시 할 의향이있는 경우를 나는 것 매우 고맙습니다 :) 미리 감사드립니다.
y 위치를 늘리시겠습니까? –
두 번째 행에서 새로운 y 위치는 120이지만 그 행에 10이 아닌 새로운 그림 상자가 하나만 나타납니다 – user3501048