如何使用for循环在vb.net中创建一组面板,然后设置名称,大小和位置?

时间:2018-07-05 03:41:33

标签: vb.net

If dgvstall.RowCount > 0 Then
    For i As Integer = 0 To x
        Dim Panel As New Panel
        Dim xloc As String = dgvstall.Rows(i).Cells(2).Value
        Dim yloc As String = dgvstall.Rows(i).Cells(3).Value
        Dim xsize As String = dgvstall.Rows(i).Cells(4).Value
        Dim ysize As String = dgvstall.Rows(i).Cells(5).Value
        Panel.BackColor = System.Drawing.Color.Black
        Panel.Location = New Point(xloc, yloc)
        Panel.Size = New Point(xsize, ysize)
        Me.Controls.Add(Panel)
    Next
End If

我要实现的是根据行数创建一组面板,然后设置名称,大小和位置

0 个答案:

没有答案