Comment définir la ligne de hauteur à TableLayoutPanel

Je suis l'ajout dynamique de lignes dans mon TableLayoutPanel mais je ne peux pas configurer il y a de la hauteur.

Le code peut paraître long, mais c'est très simple.

Une explication sur le code:

Le code crée un TableLayoutPanel et définir ses propriétés. Après cela, le code crée Pictureboxes et Labels selon la façon dont beaucoup de films il y a dans la base de données. Après la création d'un Picturebox et un Label le code met les deux dans un Panel et puis le code insère le Panel dans le TableLayoutPanel. Le problème, c'est la ligne de hauteur.

La sortie:

Comment définir la ligne de hauteur à TableLayoutPanel

Voici le code que j'utilise:

 Dim movieN As Integer = MoviesDataSet.movies.Rows.Count
Dim tablePanel As New TableLayoutPanel
With tablePanel
.Size = New Point(Me.ClientRectangle.Width - 10, Me.ClientRectangle.Bottom - 55)
.ColumnCount = 4
.GrowStyle = TableLayoutPanelGrowStyle.AddRows
.AutoScroll = True
.Margin = New System.Windows.Forms.Padding(0)
.Location = New System.Drawing.Point(5, 50)
.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset
.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 25.0!))
.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 25.0!))
.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 25.0!))
.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 25.0!))
.Anchor = AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
End With
For Each MovieRow As DataRow In MoviesDataSet.Tables("movies").Rows
'define two new controls to be added
Dim myLabel As New Label
Dim myPicture As New PictureBox
Dim container As New Panel
'set the properties of the new controls
myLabel.Text = MovieRow("movieName")
myLabel.AutoSize = True
myLabel.Location = New System.Drawing.Point(30, 110)
With myPicture
.Image = Image.FromFile(MovieRow("moviePhoto"))
.Tag = MovieRow("ID")
.Size = New System.Drawing.Size(100, 100)
.SizeMode = PictureBoxSizeMode.StretchImage
.Location = New System.Drawing.Point(2, 2)
.Cursor = Cursors.Hand
End With
'here we add the controls to a layout panel to
'manage the positioning of the controls
With container
.Dock = DockStyle.Fill
.Margin = New System.Windows.Forms.Padding(0)
.Controls.Add(myPicture)
.Controls.Add(myLabel)
End With
With tablePanel.Controls
.Add(container)
End With
'here we add a handler for the picture boxs click event
AddHandler myPicture.Click, AddressOf MyPictureClickEvent
Next
Me.Controls.Add(tablePanel)
End Sub

Merci d'avance!

est la dernière ligne qui vous tracasse?
tout ce qui me tracasse. Les premières lignes ne sont pas de l'affichage de l'étiquette, c'est parce que il n'y a pas assez de hauteur donnée à la ligne, et je n'ai aucune idée de comment faire cela.. je tiens à mettre en tous des lignes de hauteur à 180

OriginalL'auteur kfirba | 2013-02-05