WPF Button Другой класс - PullRequest
0 голосов
/ 20 апреля 2020

// Форма

 public Form1()
    {
        InitializeComponent();

        UserControl1 U01 = new UserControl1();
        Form1 f1 = new Form1();
        U01.ButtonClick += button1.BackColor = Color.Red;

    }

    private void Button1_Click(object sender, EventArgs e)
    {
        var user1 = new UserControl1();            
        this.panel1.Controls.Add(user1);

    }

// UserControl

 public UserControl1()
    {
        InitializeComponent();

    }
    public event EventHandler ButtonClick
    {
        add { button1.Click += value; }
        remove { button1.Click -= value; }
    }

Цель состоит в том, чтобы я хотел изменить цвет кнопки Form1 с нажатия кнопки на UserControl.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...