C# 将windows窗体对象添加到图形

C# 将windows窗体对象添加到图形,c#,.net-4.7.1,C#,.net 4.7.1,我有一个包含windows窗体对象的类: class SpecialButton { Button button; Label label1; Label label2; Label label3; } 我怎样才能把它画出来?我怎样才能把这个类的实例以表格的形式画出来?你说的“可画”是什么意思?。这些是控件对象,至少在实例化它们(new Button()等)、设置它们的位置(Location属性)并将它们添加到作为UserControl的容器对象(例如表单、GroupBox、Panel等)的控

我有一个包含windows窗体对象的类:

class SpecialButton {
Button button;
Label label1;
Label label2;
Label label3;
}

我怎样才能把它画出来?我怎样才能把这个类的实例以表格的形式画出来?

你说的“可画”是什么意思?。这些是控件对象,至少在实例化它们(new Button()等)、设置它们的位置(Location属性)并将它们添加到作为UserControl的容器对象(例如表单、GroupBox、Panel等)的控件集合之后,它们才开始存在。这不是最好的方法,而是将Button设为基类,并使用TextRenderer.DrawText()在OnPaint()中绘制字符串。@HansPassant我将尝试一下!谢谢