using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace direnç_hesaplama { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 0) { button2.BackColor = Color.Black; } else if (comboBox1.SelectedIndex == 1) { button2.BackColor = Color.Brown; } else if (comboBox1.SelectedIndex == 2) { button2.BackColor = Color.Red; } else if (comboBox1.SelectedIndex == 3) { button2.BackColor = Color.Orange; } else if (comboBox1.SelectedIndex == 4) { button2.BackColor = Color.Yellow; } else if (comboBox1.SelectedIndex == 5) { button2.BackColor = Color.Green; } else if (comboBox1.SelectedIndex == 6) { button2.BackColor = Color.Blue; } else if (comboBox1.SelectedIndex == 7) { button2.BackColor = Color.Purple; } else if (comboBox1.SelectedIndex == 8) { button2.BackColor = Color.Gray; } else { button2.BackColor = Color.White; } } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox2.SelectedIndex == 0) { button3.BackColor = Color.Black; } else if (comboBox2.SelectedIndex == 1) { button3.BackColor = Color.Brown; } else if (comboBox2.SelectedIndex == 2) { button3.BackColor = Color.Red; } else if (comboBox2.SelectedIndex == 3) { button3.BackColor = Color.Orange; } else if (comboBox2.SelectedIndex == 4) { button3.BackColor = Color.Yellow; } else if (comboBox2.SelectedIndex == 5) { button3.BackColor = Color.Green; } else if (comboBox2.SelectedIndex == 6) { button3.BackColor = Color.Blue; } else if (comboBox2.SelectedIndex == 7) { button3.BackColor = Color.Purple; } else if (comboBox2.SelectedIndex == 8) { button3.BackColor = Color.Gray; } else { button3.BackColor = Color.White; } } private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox3.SelectedIndex == 0) { button4.BackColor = Color.Black; } else if (comboBox3.SelectedIndex == 1) { button4.BackColor = Color.Brown; } else if (comboBox3.SelectedIndex == 2) { button4.BackColor = Color.Red; } else if (comboBox3.SelectedIndex == 3) { button4.BackColor = Color.Orange; } else if (comboBox3.SelectedIndex == 4) { button4.BackColor = Color.Yellow; } else if (comboBox3.SelectedIndex == 5) { button4.BackColor = Color.Green; } else if (comboBox3.SelectedIndex == 6) { button4.BackColor = Color.Blue; } else if (comboBox3.SelectedIndex == 7) { button4.BackColor = Color.Purple; } else if (comboBox3.SelectedIndex == 8) { button4.BackColor = Color.Gray; } else { button4.BackColor = Color.White; } } private void button1_Click(object sender, EventArgs e) { try { double Renk1, Renk2, Renk3, ohm, khom; Renk1 = comboBox1.SelectedIndex; Renk2 = comboBox2.SelectedIndex; Renk3 = comboBox3.SelectedIndex; string birlesim = Renk1.ToString() + Renk2.ToString(); ohm = Convert.ToDouble(birlesim) * Math.Pow(10, Renk3); khom = ohm / 1000; label6.Text = ohm.ToString(); label8.Text = khom.ToString(); } catch (Exception) { MessageBox.Show("boş alan bırakmayınız"); } } } } |
Bildirim