Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Open A Form with a Form

  • 17-09-2011 11:19AM
    #1
    Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭


    How do I open a form within a form (c# or any .net language) specifically in a panel.

    Current Code
            private void FncButtonClick(object sender, EventArgs e)
            {
                var form = new System.Threading.Thread(FncForm);
                form.Start();
            }
    
            private static void FncForm()
            {
                CheckForIllegalCrossThreadCalls = false;
                Application.Run(new FNCForm());
            }
    
    This will just currently load the form but not within the main form (panel).

    The other problem I run into is flickering, both in the main form and the secondary form. E.g. Redraw is slow...


Comments

  • Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭RealistSpy


    Solution:
            private void FncButtonClick(object sender, EventArgs e)
            {
                var temp = new FNCForm{ TopLevel = false };
                panel.Controls.Add(temp);
                temp.Show();           
            }
    


Advertisement