using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace LampChat { public partial class ChangeUser : Form { public ChangeUser() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { DialogResult res = colorDialog1.ShowDialog(); if (res == DialogResult.OK) { button2.BackColor = colorDialog1.Color; } } private void ChangeUser_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; Hide(); } private void button1_Click(object sender, EventArgs e) { Form1 main = Owner as Form1; string name = textBox1.Text; string color = "#" + colorDialog1.Color.R.ToString("X2") + colorDialog1.Color.G.ToString("X2") + colorDialog1.Color.B.ToString("X2"); main.SetUser(name, color); } } }