Solved

PADDING AMONG CONTROLS AT FLOWLAYOUT PANEL

Posted on 2011-02-13
2
596 Views
Last Modified: 2012-05-11
Hi All,

I put panel dynamically inside flp.
How could I add padding among panels by horizontal and vertical.

Thank you.
0
Comment
Question by:emi_sastra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 34883172
Set the Margin() Property of your dynamic Panels to the desired amount of Padding:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim di As New System.IO.DirectoryInfo("C:\Users\Mike\Pictures")
        For Each fi As System.IO.FileInfo In di.GetFiles("*.jpg")
            Dim pnl As New Panel
            pnl.BorderStyle = BorderStyle.FixedSingle
            pnl.Size = New Size(100, 100)
            pnl.Margin = New Padding(10)

            Dim pb As New PictureBox
            pb.Dock = DockStyle.Fill
            pb.SizeMode = PictureBoxSizeMode.Zoom
            pb.Image = Image.FromFile(fi.FullName)

            Dim lbl As New Label
            lbl.AutoSize = False
            lbl.Text = System.IO.Path.GetFileNameWithoutExtension(fi.Name)
            lbl.TextAlign = ContentAlignment.MiddleCenter
            lbl.Dock = DockStyle.Bottom

            pnl.Controls.Add(lbl)
            pnl.Controls.Add(pb)
            FlowLayoutPanel1.Controls.Add(pnl)
        Next
        FlowLayoutPanel1.AutoScroll = True
    End Sub

End Class

Open in new window

0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34883187
Hi Idle_Mind,

It works.

Thank you very much for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question