0
我有這個類,例如:如何使在C#中的視覺reuasable類(Visual Studio 2010中)
class labeledtext
{
private TextBox tb;
private Label l;
public labeledtext(Form frm)
{
tb = new TextBox();
l = new Label();
frm.Controls.Add(tb);
frm.Controls.Add(l);
}
public void SetCaption(string cpt)
{
l.Text = cpt;
}
public string text()
{
return tb.Text;
}
}
我想要從這個類的一個對象,可以在任何其他項目中使用作爲視覺對象。我想用它像一個文本框,將它從工具箱拖到我的表單並放置它等等。 我該怎麼做? 如果重要,我使用visual studio 2010。