在运行时添加设计时小组到的TabPage [英] Adding a Design time Panel to a TabPage at run time

查看:150
本文介绍了在运行时添加设计时小组到的TabPage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望与在设计时就可以控制一个小组,但我想这个面板添加到我的在运行时的TabControl所希望的TabPage。



我写了这样的事情,没有工作:面板不会在标签页显示。
请帮我

  panel2.Parent = tabGuy.TabPages [0]; 
tabGuy.SuspendLayout();
tabGuy.TabPages [0] .Controls.Add(是Panel2);
tabGuy.ResumeLayout();
panel2.Show();


解决方案

您可能需要设置面板​​的坐标好了,或(更好的) panel2.Dock = DockStyle.Fill;



和你没有设置在.Parent或致电.Show()


I wish to have a Panel with the controls on it at design time but I want to add this panel to a desired tabPage of my TabControl at run time.

I wrote something like this, did not work : the panel does not show up in the tab page. please help me.

panel2.Parent = tabGuy.TabPages[0];
tabGuy.SuspendLayout();
tabGuy.TabPages[0].Controls.Add(panel2);
tabGuy.ResumeLayout();
panel2.Show();

解决方案

You probably need to set the coordinates of the Panel as well, or (better) panel2.Dock = DockStyle.Fill;

And you don't have to set the .Parent or call the .Show()

这篇关于在运行时添加设计时小组到的TabPage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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