如何动态更改SplitContainer内容 [英] How to dynamically change SplitContainer contents

查看:54
本文介绍了如何动态更改SplitContainer内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我对C#完全不熟悉。我创建了一个SplitContainer,左侧有一个树视图,右侧有一个窗格。我希望右侧窗格的内容根据树视图中单击的内容进行更改。因此,右侧窗格中将有不同的小部件,具体取决于单击的树视图项。



实现此目的的最佳方法是什么?是否可以使用工具箱和拖放小部件设计不同右侧窗格内容的布局到容器上(但我不希望它在不同的表单上),或者它是否必须都在代码中完成。有没有这方面的例子 - 我还没有找到任何例子。



Mnay谢谢

解决方案

在代码中是前进的方向...



看看这个视频... http://www.youtube.com/watch?v=8JkbQY93xYY [ ^ ]



Microsoft blurb 此处 [ ^ ]



谷歌搜索的更多示例在运行时动态加载控件c#



我见过的大多数示例都只是将控件放到表单上 - 您需要将它们添加到包含的面板中,而不是

 form1.Controls.Add( ... 

你会使用像

 panel1.Controls.A这样的东西DD(... 


Hi,
I am completely new to C#. I have created a SplitContainer that has a tree view on the left and a pane on the right. I want the contents of the right-hand pane to change depending on what is clicked in the tree-view. So there will be different widgets in the right-hand pane depending on the tree-view item that was clicked.

What is the best way to achieve this? Is it possible to design the layouts of the different right-hand pane contents using the toolbox and drag-and-dropping widgets onto a container (but I don''t want it to be on a different form), or does it have to all be done in the code. Are there any examples of this - I havn''t found any yet.

Mnay thanks

解决方案

In code is the way forward...

Have a look at this video ... http://www.youtube.com/watch?v=8JkbQY93xYY[^]

Microsoft blurb is here[^]

Lots more examples by google search dynamically load controls at runtime c# "

Most of the examples I''ve seen just put the controls onto the form - you will need to add them to the containing panel so instead of

form1.Controls.Add(...

you''ll use something like

panel1.Controls.Add(...


这篇关于如何动态更改SplitContainer内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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