使用面板容器的C#问题 [英] C# problem using a panel container
本文介绍了使用面板容器的C#问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个表单,该表单应该在面板中显示一些控件.
现在您已经设法获得了我需要的功能,但是性能相当差,而且稳定性也很差.
所以我在面板容器中有2个控件:
hi all,
i have a form which suppose to show some controls in a panel.
now u have managed to get the functinality i need, but the performance is quite poor and also the stabilty.
so i have 2 controls inside a panel container:
this.splitContainer.Panel2.Controls.Add(ctrl1);
this.splitContainer.Panel2.Controls.Add(ctrl2);
现在我想根据一些button_click事件在它们之间切换.
它不起作用.
我的应用现在可以与此代码一起使用:
now i want to switch between them according to some button_click event.
it doesn''t work.
my app works now with this code:
this.splitContainer.Panel2.Controls.Clear();
this.splitContainer.Panel2.Controls.Add(ctrl);
this.splitContainer.Panel2.Show();
有人有主意吗?
thx!
anyone has an idea?
thx!
推荐答案
我不确定在面板之间切换意味着什么.
您是不是要清除Panel2中的所有控件并将它们添加到面板1中?
您在此处添加的代码应该可以正常工作,但这是您所需要的吗?
:confused:
I am not sure what you meant by switching between panels.
did you mean that you want to clear all the controls from Panel2 and add them to panel 1 ??
The code that you added here should be working, but is this what you needed ?
:confused:
嗨Abhishek Sur,
我不想在两个面板之间切换.相反,我有1个面板,其中包含2个控件.我想切换控件的可见性,以便每时每刻显示ctrl1或ctrl2.
再一次,我不想使用Clear()和Add()方法,因为它们调用了VisibilityChanged事件,但我想使用它.
thx!
hi Abhishek Sur,
i don''t want to switch bewteen panels. rather, i have 1 Panel, which contains 2 Controls. i want to switch the visibility of the Controls such that in every moment either ctrl1 or ctrl2 is displayed.
once again, i don''t want to use the Clear() and Add() methods, because they invoke the VisibilityChanged Event, hwich i would like to use.
thx!
这篇关于使用面板容器的C#问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文