private void OnEnable() { SetSelected(false); _button = GetComponent <Button>(); GetComponent <Image>().color = color; _colorSection = GetComponentInParent <ColorSection>(); _button.onClick.AddListener(() => _colorSection.ChangeSelected(this)); }
/// <summary> /// Method untuk membaca konfigurasi warna yang di simpan di file app.config /// </summary> /// <param name="colorSection"></param> /// <returns></returns> private static Color GetRgbColor(ColorSection colorSection) { var rgbColor = new string[] { "0", "0", "0" }; var colorManager = (NameValueCollection)ConfigurationManager.GetSection("colorManager"); if (colorManager != null) { rgbColor = colorManager[colorSection.ToString()].Split(','); } else { // set warna default switch (colorSection) { case ColorSection.FormBackColor: rgbColor = new string[] { "255", "255", "255" }; break; case ColorSection.PanelHeaderBackColor: rgbColor = new string[] { "31", "86", "125" }; break; case ColorSection.PanelFooterBackColor: rgbColor = new string[] { "31", "86", "125" }; break; case ColorSection.LabelHeaderForeColor: rgbColor = new string[] { "255", "255", "255" }; break; case ColorSection.TextFocusColor: rgbColor = new string[] { "255", "255", "192" }; break; default: break; } } return(Color.FromArgb(Convert.ToInt32(rgbColor[0]), Convert.ToInt32(rgbColor[1]), Convert.ToInt32(rgbColor[2]))); }
private void button4_Click(object sender, EventArgs e) { _colorsection = ColorSection.Back; ShowValues(BackPanel.BackColor); }
private void button3_Click(object sender, EventArgs e) { _colorsection = ColorSection.Press; ShowValues(PressPanel.BackColor); }