using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CKUERA { public partial class colores : Form { public colores() { InitializeComponent(); } private void butPrincipal_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); this.BackColor = colorDialog1.Color; Barra_supe.BackColor = colorDialog1.Color; label2.BackColor=colorDialog1.Color; butPrincipal.BackColor=colorDialog1.Color; butFuente.BackColor=colorDialog1.Color; butFondo.BackColor=colorDialog1.Color; label1.ForeColor = colorDialog1.Color; // CREA UN ARCHIVO NUEVO string ruta1 = Application.StartupPath + @"\ColorSistema.inf"; var escritor1 = new StreamWriter(ruta1); escritor1.WriteLine(colorDialog1.Color); escritor1.Close(); } private void butFondo_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); Fondo.BackColor = colorDialog1.Color; label1.BackColor = colorDialog1.Color; // CREA UN ARCHIVO NUEVO string ruta1 = Application.StartupPath + @"\ColorFondo.inf"; var escritor1 = new StreamWriter(ruta1); escritor1.WriteLine(colorDialog1.Color); escritor1.Close(); } private void butFuente_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); Barra_supe.ForeColor = colorDialog1.Color; label2.ForeColor = colorDialog1.Color; butFondo.ForeColor = colorDialog1.Color; butFuente.ForeColor = colorDialog1.Color; butPrincipal.ForeColor = colorDialog1.Color; // CREA UN ARCHIVO NUEVO string ruta1 = Application.StartupPath + @"\ColorFuente.inf"; var escritor1 = new StreamWriter(ruta1); escritor1.WriteLine(colorDialog1.Color); escritor1.Close(); } private void colores_Load(object sender, EventArgs e) { { string ruta = Application.StartupPath + @"\ColorSistema.inf"; var lec = new StreamReader(ruta); string s = lec.ReadToEnd().Replace("\n", ""); s = s.Replace("\r", ""); s = s.Replace(" ", ""); s = s.Replace("[", ""); s = s.Replace("]", ""); s = s.Replace("A=", ""); s = s.Replace("R=", ""); s = s.Replace("G=", ""); s = s.Replace("B=", ""); s = s.Replace("Color", ""); lec.Close(); try { string[] rows; rows = s.Split(','); int c1 = int.Parse(rows[1]) + 100; if (c1 < 0 || c1 > 255) { c1 = 200; } Global.ColorSistema = Color.FromArgb(int.Parse(rows[0]), int.Parse(rows[1]), int.Parse(rows[2]), int.Parse(rows[3])); Global.ColorMouseMuve = Color.FromArgb(int.Parse(rows[0]), c1, int.Parse(rows[2]), int.Parse(rows[3])); } catch (Exception) { Global.ColorSistema = Color.FromName(s); } this.BackColor = Global.ColorSistema; butFuente.BackColor = Global.ColorSistema; butPrincipal.BackColor = Global.ColorSistema; butFondo.BackColor= Global.ColorSistema; Barra_supe.BackColor=Global.ColorSistema; } try {//color de fondo string ruta = Application.StartupPath + @"\ColorFondo.inf"; var lec = new StreamReader(ruta); string s = lec.ReadToEnd().Replace("\n", ""); s = s.Replace("\r", ""); s = s.Replace(" ", ""); s = s.Replace("[", ""); s = s.Replace("]", ""); s = s.Replace("A=", ""); s = s.Replace("R=", ""); s = s.Replace("G=", ""); s = s.Replace("B=", ""); s = s.Replace("Color", ""); lec.Close(); try { string[] rows; rows = s.Split(','); Global.ColorFondo = Color.FromArgb(int.Parse(rows[0]), int.Parse(rows[1]), int.Parse(rows[2]), int.Parse(rows[3])); } catch (Exception) { Global.ColorFondo = Color.FromName(s); } Fondo.BackColor = Global.ColorFondo; label1.BackColor = Global.ColorFondo; } catch { } try {//color de fuente string ruta = Application.StartupPath + @"\ColorFuente.inf"; var lec = new StreamReader(ruta); string s = lec.ReadToEnd().Replace("\n", ""); s = s.Replace("\r", ""); s = s.Replace(" ", ""); s = s.Replace("[", ""); s = s.Replace("]", ""); s = s.Replace("A=", ""); s = s.Replace("R=", ""); s = s.Replace("G=", ""); s = s.Replace("B=", ""); s = s.Replace("Color", ""); lec.Close(); try { string[] rows; rows = s.Split(','); Global.ColorFuente = Color.FromArgb(int.Parse(rows[0]), int.Parse(rows[1]), int.Parse(rows[2]), int.Parse(rows[3])); } catch (Exception) { Global.ColorFuente = Color.FromName(s); } Barra_supe.ForeColor = Global.ColorFuente; label1.ForeColor = Global.ColorSistema; butFuente.ForeColor = Global.ColorFuente; butFondo.ForeColor = Global.ColorFuente; butPrincipal.ForeColor= Global.ColorFuente; label2.ForeColor = Global.ColorFuente; } catch { } } private void Fondo_Click(object sender, EventArgs e) { } private void colores_FormClosed(object sender, FormClosedEventArgs e) { MessageBox.Show("El sistema se cerrará, vuelva a iniciar para que apliquen los cambios."); Application.Exit(); } } }