How to work with controls inside the Panels that are already inside a FlowLayoutPanel?










-1














I am creating a view, something like a timeline in video-making tools.

I am using FlowLayoutPanel that will contain all my additional "tracks" in vertical type.

Every "track" is a FlowLayoutPanel that includes Buttons. The FlowLayoutPanel is one for the whole Form.

FlowLayoutPanels include Buttons that I am generating dynamically from code.



Now my code can generate FlowLayoutPanels inside the FlowLayoutPanel one by one.

But how can I work (resize, delete, change content) with generated FlowLayout Panels and controls that I am adding inside main FlowLayoutPanel?



enter image description here










share|improve this question























  • Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
    – obl
    Nov 12 at 17:37















-1














I am creating a view, something like a timeline in video-making tools.

I am using FlowLayoutPanel that will contain all my additional "tracks" in vertical type.

Every "track" is a FlowLayoutPanel that includes Buttons. The FlowLayoutPanel is one for the whole Form.

FlowLayoutPanels include Buttons that I am generating dynamically from code.



Now my code can generate FlowLayoutPanels inside the FlowLayoutPanel one by one.

But how can I work (resize, delete, change content) with generated FlowLayout Panels and controls that I am adding inside main FlowLayoutPanel?



enter image description here










share|improve this question























  • Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
    – obl
    Nov 12 at 17:37













-1












-1








-1







I am creating a view, something like a timeline in video-making tools.

I am using FlowLayoutPanel that will contain all my additional "tracks" in vertical type.

Every "track" is a FlowLayoutPanel that includes Buttons. The FlowLayoutPanel is one for the whole Form.

FlowLayoutPanels include Buttons that I am generating dynamically from code.



Now my code can generate FlowLayoutPanels inside the FlowLayoutPanel one by one.

But how can I work (resize, delete, change content) with generated FlowLayout Panels and controls that I am adding inside main FlowLayoutPanel?



enter image description here










share|improve this question















I am creating a view, something like a timeline in video-making tools.

I am using FlowLayoutPanel that will contain all my additional "tracks" in vertical type.

Every "track" is a FlowLayoutPanel that includes Buttons. The FlowLayoutPanel is one for the whole Form.

FlowLayoutPanels include Buttons that I am generating dynamically from code.



Now my code can generate FlowLayoutPanels inside the FlowLayoutPanel one by one.

But how can I work (resize, delete, change content) with generated FlowLayout Panels and controls that I am adding inside main FlowLayoutPanel?



enter image description here







c# winforms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 17:43

























asked Nov 12 at 17:31









Bogdan Deadr1der Yanko

12




12











  • Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
    – obl
    Nov 12 at 17:37
















  • Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
    – obl
    Nov 12 at 17:37















Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
– obl
Nov 12 at 17:37




Welcome to Stack Overflow! In order to help us help you, please post some code and make your question more specific as to what the problem is.
– obl
Nov 12 at 17:37












1 Answer
1






active

oldest

votes


















0














I have created a sample based on your view. hope this will help you to clear it out. you can add your required stuffs one by one.



 private Dictionary<string, FlowLayoutPanel> tracks = new Dictionary<string, FlowLayoutPanel>();
public TestFlowLayout()

InitializeComponent();
this.AutoScroll = true;
// for test
for (int i = 1; i <= 5; i++)

AddTrack("Track" + i.ToString());

for (int j = 1; j <= 10; j++)

AddButton("Track" + i.ToString(), "Button" + j.ToString());




public void AddTrack(string name)

FlowLayoutPanel panel = new FlowLayoutPanel();
panel.AutoSize = true;
panel.Dock = DockStyle.Top;
this.Controls.Add(panel);
tracks.Add(name, panel);


public void AddButton(string name, string caption)

Button button = new Button();
button.Text = caption;
tracks[name].Controls.Add(button);



In case, you need track like group by group then you can change your code little bit



 public void AddTrack(string name)

GroupBox group = new GroupBox();
group.Text = name;
group.Dock = DockStyle.Top;
group.AutoSize = false;
this.Controls.Add(group);
group.BringToFront();
FlowLayoutPanel panel = new FlowLayoutPanel();
panel.SizeChanged += Panel_SizeChanged;
panel.AutoSize = true;
panel.Dock = DockStyle.Top;
group.Controls.Add(panel);
tracks.Add(name, panel);


private void Panel_SizeChanged(object sender, EventArgs e)

FlowLayoutPanel panel = (FlowLayoutPanel)sender;
panel.Parent.Height = panel.Size.Height+20;






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267262%2fhow-to-work-with-controls-inside-the-panels-that-are-already-inside-a-flowlayout%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I have created a sample based on your view. hope this will help you to clear it out. you can add your required stuffs one by one.



     private Dictionary<string, FlowLayoutPanel> tracks = new Dictionary<string, FlowLayoutPanel>();
    public TestFlowLayout()

    InitializeComponent();
    this.AutoScroll = true;
    // for test
    for (int i = 1; i <= 5; i++)

    AddTrack("Track" + i.ToString());

    for (int j = 1; j <= 10; j++)

    AddButton("Track" + i.ToString(), "Button" + j.ToString());




    public void AddTrack(string name)

    FlowLayoutPanel panel = new FlowLayoutPanel();
    panel.AutoSize = true;
    panel.Dock = DockStyle.Top;
    this.Controls.Add(panel);
    tracks.Add(name, panel);


    public void AddButton(string name, string caption)

    Button button = new Button();
    button.Text = caption;
    tracks[name].Controls.Add(button);



    In case, you need track like group by group then you can change your code little bit



     public void AddTrack(string name)

    GroupBox group = new GroupBox();
    group.Text = name;
    group.Dock = DockStyle.Top;
    group.AutoSize = false;
    this.Controls.Add(group);
    group.BringToFront();
    FlowLayoutPanel panel = new FlowLayoutPanel();
    panel.SizeChanged += Panel_SizeChanged;
    panel.AutoSize = true;
    panel.Dock = DockStyle.Top;
    group.Controls.Add(panel);
    tracks.Add(name, panel);


    private void Panel_SizeChanged(object sender, EventArgs e)

    FlowLayoutPanel panel = (FlowLayoutPanel)sender;
    panel.Parent.Height = panel.Size.Height+20;






    share|improve this answer



























      0














      I have created a sample based on your view. hope this will help you to clear it out. you can add your required stuffs one by one.



       private Dictionary<string, FlowLayoutPanel> tracks = new Dictionary<string, FlowLayoutPanel>();
      public TestFlowLayout()

      InitializeComponent();
      this.AutoScroll = true;
      // for test
      for (int i = 1; i <= 5; i++)

      AddTrack("Track" + i.ToString());

      for (int j = 1; j <= 10; j++)

      AddButton("Track" + i.ToString(), "Button" + j.ToString());




      public void AddTrack(string name)

      FlowLayoutPanel panel = new FlowLayoutPanel();
      panel.AutoSize = true;
      panel.Dock = DockStyle.Top;
      this.Controls.Add(panel);
      tracks.Add(name, panel);


      public void AddButton(string name, string caption)

      Button button = new Button();
      button.Text = caption;
      tracks[name].Controls.Add(button);



      In case, you need track like group by group then you can change your code little bit



       public void AddTrack(string name)

      GroupBox group = new GroupBox();
      group.Text = name;
      group.Dock = DockStyle.Top;
      group.AutoSize = false;
      this.Controls.Add(group);
      group.BringToFront();
      FlowLayoutPanel panel = new FlowLayoutPanel();
      panel.SizeChanged += Panel_SizeChanged;
      panel.AutoSize = true;
      panel.Dock = DockStyle.Top;
      group.Controls.Add(panel);
      tracks.Add(name, panel);


      private void Panel_SizeChanged(object sender, EventArgs e)

      FlowLayoutPanel panel = (FlowLayoutPanel)sender;
      panel.Parent.Height = panel.Size.Height+20;






      share|improve this answer

























        0












        0








        0






        I have created a sample based on your view. hope this will help you to clear it out. you can add your required stuffs one by one.



         private Dictionary<string, FlowLayoutPanel> tracks = new Dictionary<string, FlowLayoutPanel>();
        public TestFlowLayout()

        InitializeComponent();
        this.AutoScroll = true;
        // for test
        for (int i = 1; i <= 5; i++)

        AddTrack("Track" + i.ToString());

        for (int j = 1; j <= 10; j++)

        AddButton("Track" + i.ToString(), "Button" + j.ToString());




        public void AddTrack(string name)

        FlowLayoutPanel panel = new FlowLayoutPanel();
        panel.AutoSize = true;
        panel.Dock = DockStyle.Top;
        this.Controls.Add(panel);
        tracks.Add(name, panel);


        public void AddButton(string name, string caption)

        Button button = new Button();
        button.Text = caption;
        tracks[name].Controls.Add(button);



        In case, you need track like group by group then you can change your code little bit



         public void AddTrack(string name)

        GroupBox group = new GroupBox();
        group.Text = name;
        group.Dock = DockStyle.Top;
        group.AutoSize = false;
        this.Controls.Add(group);
        group.BringToFront();
        FlowLayoutPanel panel = new FlowLayoutPanel();
        panel.SizeChanged += Panel_SizeChanged;
        panel.AutoSize = true;
        panel.Dock = DockStyle.Top;
        group.Controls.Add(panel);
        tracks.Add(name, panel);


        private void Panel_SizeChanged(object sender, EventArgs e)

        FlowLayoutPanel panel = (FlowLayoutPanel)sender;
        panel.Parent.Height = panel.Size.Height+20;






        share|improve this answer














        I have created a sample based on your view. hope this will help you to clear it out. you can add your required stuffs one by one.



         private Dictionary<string, FlowLayoutPanel> tracks = new Dictionary<string, FlowLayoutPanel>();
        public TestFlowLayout()

        InitializeComponent();
        this.AutoScroll = true;
        // for test
        for (int i = 1; i <= 5; i++)

        AddTrack("Track" + i.ToString());

        for (int j = 1; j <= 10; j++)

        AddButton("Track" + i.ToString(), "Button" + j.ToString());




        public void AddTrack(string name)

        FlowLayoutPanel panel = new FlowLayoutPanel();
        panel.AutoSize = true;
        panel.Dock = DockStyle.Top;
        this.Controls.Add(panel);
        tracks.Add(name, panel);


        public void AddButton(string name, string caption)

        Button button = new Button();
        button.Text = caption;
        tracks[name].Controls.Add(button);



        In case, you need track like group by group then you can change your code little bit



         public void AddTrack(string name)

        GroupBox group = new GroupBox();
        group.Text = name;
        group.Dock = DockStyle.Top;
        group.AutoSize = false;
        this.Controls.Add(group);
        group.BringToFront();
        FlowLayoutPanel panel = new FlowLayoutPanel();
        panel.SizeChanged += Panel_SizeChanged;
        panel.AutoSize = true;
        panel.Dock = DockStyle.Top;
        group.Controls.Add(panel);
        tracks.Add(name, panel);


        private void Panel_SizeChanged(object sender, EventArgs e)

        FlowLayoutPanel panel = (FlowLayoutPanel)sender;
        panel.Parent.Height = panel.Size.Height+20;







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 13 at 7:42

























        answered Nov 13 at 7:25









        Baskar John

        67647




        67647



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267262%2fhow-to-work-with-controls-inside-the-panels-that-are-already-inside-a-flowlayout%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            Evgeni Malkin