本文介绍了在运行时向父控件添加控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要添加一个在运行时添加的控件到父控件(面板)我可以设置对象的属性 (PictureEdit) 但我如何显示它...将它添加到父控件???谢谢
I need to add a control added at runtime to the parent control (panel)I can set the properties of the object (PictureEdit) but how do i display it...add it to the parent control???thank you
protected override void OnPaint(PaintEventArgs pe)
{
PictureEdit halfmoon = new PictureEdit();
halfmoon.Location = new Point(36, 3);
halfmoon.BorderStyle = BorderStyles.NoBorder;
halfmoon.Properties.SizeMode = PictureSizeMode.Squeeze;
halfmoon.Image = Properties.Resources.picture;
}
推荐答案
Panel_name.Controls.Add(halfmoon);
这篇关于在运行时向父控件添加控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!