Динамически создаваемая кнопка не появляется на окне
Изменил код:
public partial class Form1 : Form{
NewButton newbutton = new NewButton();
public Form1(){
InitializeComponent();
Draw();
}
private void Draw(){
Button button = new Button();
newbutton.dynamicButton(button, 100, 30, 100, 30);
Controls.Add(button);
}
}
internal class NewButton{
public void dynamicButton(Button button, int left, int top, int width, int height){
button.Location = new Point(left, top);
button.Size = new Size(width, height);
button.Text = "newbutton";
}
}
так я делал но это не то что мне надо в итоге, а в итоге мне надо один вызов без ссылки и создания в форме:
private void Draw(){
newbutton.dynamicButton(100, 30, 100, 30);
}