我正在尝试制作一个右侧带有按钮的文本框。
我的代码:
public partial class TextBoxButton : TextBox
{
[Category("Button")]
[Description("Button in textbox")]
public Button Button
{
get
{
return this.btn;
}
set
{
this.btn = value;
}
}
protected override void OnCreateControl()
{
if (!this.Controls.Contains(this.btn))
{
this.Controls.Add(this.btn);
this.btn.Dock = DockStyle.Right;
}
base.OnCreateControl();
}
}
每次当我启动 appi 并在按钮中设置一些文本或图像时,它都是空的。一些想法?
此致。
不要将按钮添加到文本框中,而是使用一些容器(Control 或 UserControl 并添加文本框和按钮)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)