通过Class C#3.0访问面板 [英] Accessing a pannel via Class C#3.0

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

问题描述

大家好

希望你能帮我 !我有一个应用程序,每次您单击不同的树视图节点时,都会打开一个称为控制器类的类的实例.然后,该类在选项卡页面中创建一个面板.在我的Controllerclass中,我引用了另一个类(Commentclass),以创建另一个具有不同控件的面板.我的问题是,当我引用注释类时,我使第一个面板可见性为假,但是当我想从注释类中使它为真时,我不能

任何人都可以请教吗?


谢谢

Hi Guys

Hope you can help me ! I have a application that opens a instance of a class called controller class each time you click on a different treeview node. the class then creates a panel in a tabpage. In my Controllerclass i references another class (Commentclass) creating a other panel with different controls on. My problem is that when i reference Comment class I make the 1st panel visibility false but when i want to make it true from comment class i cant

Can anyone please advice?


Thanks

推荐答案

如果要执行此操作,则必须在第二个面板中维护对第一个面板的引用:创建一个类级别的面板可变,并在其中隐藏该面板,将引用保存到您刚刚隐藏的面板.然后,您可以使用它稍后显示面板.
You have to maintain a reference to the 1st panel in the second if you want to do this: Create a class level Panel varaiable and where you hide the panel, save the reference to the panel you just hid. You can then use this to show the panel later.
private Panel myOtherPanel = null;
...
theOtherPanel.Visible = false;
myOtherPanel = theOtherPanel;
...
if (myOtherPanel != null)
   { 
   myOtherPanel.Visible = true;
   }


这篇关于通过Class C#3.0访问面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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