Solved

PADDING AMONG CONTROLS AT FLOWLAYOUT PANEL

Posted on 2011-02-13
2
544 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
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
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
Comment Utility
Hi Idle_Mind,

It works.

Thank you very much for your help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now