none
How to adjust spacing between controls in flowLayoutPanel using c#

    Question

  • Hi,

    I am adding linklable control in flowLayoutPanel1 at runtime but it will take too much space between two controls.

    I am trying like this,

               for (int n = 1; n <= NumCnt; n++)
                {
                    LinkLabel lbl = new LinkLabel();
                    lbl.Text = n.ToString();
                    flowLayoutPanel1.Controls.Add(lbl);
                }

    i want to display it like paging (numbers). i am setting padding as well as margin to 0. 

    Thanks in advance.


    Experience the innovation with perfection.

    Tuesday, January 08, 2013 10:50 AM

Answers

  • Try this:

        LinkLabel lbl = new LinkLabel { AutoSize = true };

    • Marked as answer by Bhagawat Tuesday, January 08, 2013 11:23 AM
    Tuesday, January 08, 2013 11:18 AM

All replies

  • Change the value of the Control.Margin of the contained controls.

    With Thanks and Regards
    Sambath Raj.C
    click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
    Happy Programming!

    Tuesday, January 08, 2013 11:08 AM
  • Try this:

        LinkLabel lbl = new LinkLabel { AutoSize = true };

    • Marked as answer by Bhagawat Tuesday, January 08, 2013 11:23 AM
    Tuesday, January 08, 2013 11:18 AM
  • Hi,

    Can you please post screenshot?


    Toni Petrina
    My blog: Toni codes .NET
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful"

    Tuesday, January 08, 2013 12:52 PM