FlowLayoutPanel问题 [英] FlowLayoutPanel problem

查看:85
本文介绍了FlowLayoutPanel问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.
我有个问题.

我有两种形式,在Form1中,我有一个FlowLayuotPanel,其中包含x个按钮.但是问题来了,然后Form2尝试在Form1中调用重新加载FlowLayoutPanel,它只是将其加载到另一个FLowLayoutPanel的顶部,结果是大量的内存消耗.

Hello.
I have a problem.

I have two forms and in Form1 I have a FlowLayuotPanel which contains x amount of buttons. But the problem comes then in Form2 trys to call reload the FlowLayoutPanel back in Form1, it just load it on top on the other FLowLayoutPanel, the result is an massive memory consumption.

Form1 f;
private void Form2_MouseClick(object sender, MouseEventArgs e)
{
    if (f != null)
    {
        f.Dispose();
    }
        f = new Form1();
    f.loadPersonCardTest(adGroups);
    f.Update();
    f.Show();
}



是否可以在重新添加之前删除FlowLayoutPanel包含的内容.



Is it possible to remove the FlowLayoutPanel contains before adding to it again.

推荐答案

请在创建Form1之后发布正在调用的函数的代码.我认为您是在表单的构造函数中以及在loadPersonCardTest()中再次向表单中添加FlowLayoutPanel.但是,如果没有其他代码,我将无济于事.

只是好奇,处置和重新创建f的原因是什么?
Please post the code of the function being called after Form1 is created. I am thinking that you are adding a FlowLayoutPanel to the form in the constructor of the form, and once again in loadPersonCardTest(). However, I cannot help much more without additional code.

Just curious, what is the reason for disposing and recreating f?


这篇关于FlowLayoutPanel问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆