6 Mart 2015 Cuma

C# Direnç Renk Kodu Okuma Kodları



















using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;



namespace direnc_renk_kodu
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
         
            textBox1.TextChanged += new EventHandler(hesapla);
            textBox2.TextChanged += new EventHandler(hesapla);
            textBox3.TextChanged += new EventHandler(hesapla);

            textBox46.TextChanged += new EventHandler(hesapla1);
            textBox47.TextChanged += new EventHandler(hesapla1);
            textBox48.TextChanged += new EventHandler(hesapla1);
            textBox49.TextChanged += new EventHandler(hesapla1);
        }

        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox4.Text)
            {

                case "Altın": pictureBox4.BackColor = System.Drawing.Color.Gold; textBox3.Text = "0,1"; break;
                case "Gümüş": pictureBox4.BackColor = System.Drawing.Color.Silver; textBox3.Text = "0,01"; break;
                case "Siyah": pictureBox4.BackColor = System.Drawing.Color.Black; textBox3.Text = "1"; break;
                case "K.Rengi": pictureBox4.BackColor = System.Drawing.Color.Brown; textBox3.Text = "10"; break;
                case "Kırmızı": pictureBox4.BackColor = System.Drawing.Color.Red; textBox3.Text = "100"; break;
                case "Turuncu": pictureBox4.BackColor = System.Drawing.Color.Orange; textBox3.Text = "1000"; break;
                case "Sarı": pictureBox4.BackColor = System.Drawing.Color.Yellow; textBox3.Text = "10000"; break;
                case "Yeşil": pictureBox4.BackColor = System.Drawing.Color.Green; textBox3.Text = "100000"; break;
                case "Mavi": pictureBox4.BackColor = System.Drawing.Color.Blue; textBox3.Text = "1000000"; break;


            }
        }
        private void hesapla1(object sender, EventArgs e)
        {
            if (textBox46.Text != "" && textBox47.Text != "" && textBox48.Text != "" && textBox49.Text != "")
            {

                textBox42.Text = Convert.ToString(Convert.ToDecimal(textBox48.Text + textBox47.Text + textBox49.Text) * Convert.ToDecimal(textBox46.Text));
            }

        }

        private void hesapla(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
            {

                textBox7.Text = Convert.ToString(Convert.ToDecimal(textBox1.Text + textBox2.Text) * Convert.ToDecimal(textBox3.Text));
            }

        }

        private void textBox7_TextChanged(object sender, EventArgs e)
        {
            textBox6.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) / 1000);
            textBox5.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) / 1000000);
            textBox4.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) / 1000000000);
            textBox8.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) * 1000);
            textBox9.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) * 1000000);
            textBox10.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) * 1000000000);
            textBox11.Text = Convert.ToString(Convert.ToDecimal(textBox7.Text) * 1000000000000);
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox3.Text)
            {

                case "Altın": pictureBox5.BackColor = System.Drawing.Color.Gold; textBox12.Text = "± %5 Tolerans"; break;
                case "Gümüş": pictureBox5.BackColor = System.Drawing.Color.Silver; textBox12.Text = "± %10 Tolerans"; break;
                case "K.Rengi": pictureBox5.BackColor = System.Drawing.Color.Brown; textBox12.Text = "± %1 Tolerans"; break;
                case "Kırmızı": pictureBox5.BackColor = System.Drawing.Color.Red; textBox12.Text = "± %2 Tolerans"; break;


                case "Yeşil": pictureBox5.BackColor = System.Drawing.Color.Green; textBox12.Text = "± %0,5 Tolerans"; break;
                case "Mavi": pictureBox5.BackColor = System.Drawing.Color.Blue; textBox12.Text = "± %0,25 Tolerans"; break;
                case "Gri": pictureBox5.BackColor = System.Drawing.Color.Gray; textBox12.Text = "± %0,05 Tolerans"; break;
                case "Mor": pictureBox5.BackColor = System.Drawing.Color.Purple; textBox12.Text = "± %0,1 Tolerans"; break;
                case "Renksiz": pictureBox4.BackColor = System.Drawing.Color.Transparent; textBox12.Text = "± %20 Tolerans"; break;


            }
        }

        private void comboBox16_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox16.Text)
            {
                case "Siyah": pictureBox20.BackColor = System.Drawing.Color.Black; textBox48.Text = "0"; break;
                case "K.rengi": pictureBox20.BackColor = System.Drawing.Color.Brown; textBox48.Text = "1"; break;
                case "Kırmızı": pictureBox20.BackColor = System.Drawing.Color.Red; textBox48.Text = "2"; break;
                case "Turuncu": pictureBox20.BackColor = System.Drawing.Color.Orange; textBox48.Text = "3"; break;
                case "Sarı": pictureBox20.BackColor = System.Drawing.Color.Yellow; textBox48.Text = "4"; break;
                case "Yeşil": pictureBox20.BackColor = System.Drawing.Color.Green; textBox48.Text = "5"; break;
                case "Mavi": pictureBox20.BackColor = System.Drawing.Color.Blue; textBox48.Text = "6"; break;
                case "Mor": pictureBox20.BackColor = System.Drawing.Color.Purple; textBox48.Text = "7"; break;
                case "Gri": pictureBox20.BackColor = System.Drawing.Color.Gray; textBox48.Text = "8"; break;
                case "Beyaz": pictureBox20.BackColor = System.Drawing.Color.White; textBox48.Text = "9"; break;

            }
        }

        private void comboBox15_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox15.Text)
            {
                case "Siyah": pictureBox17.BackColor = System.Drawing.Color.Black; textBox47.Text = "0"; break;
                case "K.rengi": pictureBox17.BackColor = System.Drawing.Color.Brown; textBox47.Text = "1"; break;
                case "Kırmızı": pictureBox17.BackColor = System.Drawing.Color.Red; textBox47.Text = "2"; break;
                case "Turuncu": pictureBox17.BackColor = System.Drawing.Color.Orange; textBox47.Text = "3"; break;
                case "Sarı": pictureBox17.BackColor = System.Drawing.Color.Yellow; textBox47.Text = "4"; break;
                case "Yeşil": pictureBox17.BackColor = System.Drawing.Color.Green; textBox47.Text = "5"; break;
                case "Mavi": pictureBox17.BackColor = System.Drawing.Color.Blue; textBox47.Text = "6"; break;
                case "Mor": pictureBox17.BackColor = System.Drawing.Color.Purple; textBox47.Text = "7"; break;
                case "Gri": pictureBox17.BackColor = System.Drawing.Color.Gray; textBox47.Text = "8"; break;
                case "Beyaz": pictureBox17.BackColor = System.Drawing.Color.White; textBox47.Text = "9"; break;

            }
        }

        private void comboBox17_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox17.Text)
            {
                case "Siyah": pictureBox19.BackColor = System.Drawing.Color.Black; textBox49.Text = "0"; break;
                case "K.rengi": pictureBox19.BackColor = System.Drawing.Color.Brown; textBox49.Text = "1"; break;
                case "Kırmızı": pictureBox19.BackColor = System.Drawing.Color.Red; textBox49.Text = "2"; break;
                case "Turuncu": pictureBox19.BackColor = System.Drawing.Color.Orange; textBox49.Text = "3"; break;
                case "Sarı": pictureBox19.BackColor = System.Drawing.Color.Yellow; textBox49.Text = "4"; break;
                case "Yeşil": pictureBox19.BackColor = System.Drawing.Color.Green; textBox49.Text = "5"; break;
                case "Mavi": pictureBox19.BackColor = System.Drawing.Color.Blue; textBox49.Text = "6"; break;
                case "Mor": pictureBox19.BackColor = System.Drawing.Color.Purple; textBox49.Text = "7"; break;
                case "Gri": pictureBox19.BackColor = System.Drawing.Color.Gray; textBox49.Text = "8"; break;
                case "Beyaz": pictureBox19.BackColor = System.Drawing.Color.White; textBox49.Text = "9"; break;

            }
        }

        private void comboBox14_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox14.Text)
            {

                case "Altın": pictureBox21.BackColor = System.Drawing.Color.Gold; textBox46.Text = "0,1"; break;
                case "Gümüş": pictureBox21.BackColor = System.Drawing.Color.Silver; textBox46.Text = "0,01"; break;
                case "Siyah": pictureBox21.BackColor = System.Drawing.Color.Black; textBox46.Text = "1"; break;
                case "K.Rengi": pictureBox21.BackColor = System.Drawing.Color.Brown; textBox46.Text = "10"; break;
                case "Kırmızı": pictureBox21.BackColor = System.Drawing.Color.Red; textBox46.Text = "100"; break;
                case "Turuncu": pictureBox21.BackColor = System.Drawing.Color.Orange; textBox46.Text = "1000"; break;
                case "Sarı": pictureBox21.BackColor = System.Drawing.Color.Yellow; textBox46.Text = "10000"; break;
                case "Yeşil": pictureBox21.BackColor = System.Drawing.Color.Green; textBox46.Text = "100000"; break;
                case "Mavi": pictureBox21.BackColor = System.Drawing.Color.Blue; textBox46.Text = "1000000"; break;


            }
        }

        private void comboBox13_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox13.Text)
            {

                case "Altın": pictureBox18.BackColor = System.Drawing.Color.Gold; textBox37.Text = "± %5 Tolerans"; break;
                case "Gümüş": pictureBox18.BackColor = System.Drawing.Color.Silver; textBox37.Text = "± %10 Tolerans"; break;
                case "K.Rengi": pictureBox18.BackColor = System.Drawing.Color.Brown; textBox37.Text = "± %1 Tolerans"; break;
                case "Kırmızı": pictureBox18.BackColor = System.Drawing.Color.Red; textBox37.Text = "± %2 Tolerans"; break;


                case "Yeşil": pictureBox18.BackColor = System.Drawing.Color.Green; textBox37.Text = "± %0,5 Tolerans"; break;
                case "Mavi": pictureBox18.BackColor = System.Drawing.Color.Blue; textBox37.Text = "± %0,25 Tolerans"; break;
                case "Gri": pictureBox18.BackColor = System.Drawing.Color.Gray; textBox37.Text = "± %0,05 Tolerans"; break;
                case "Mor": pictureBox18.BackColor = System.Drawing.Color.Purple; textBox37.Text = "± %0,1 Tolerans"; break;
                case "Renksiz": pictureBox18.BackColor = System.Drawing.Color.Transparent; textBox37.Text = "± %20 Tolerans"; break;


            }
        }

        private void textBox42_TextChanged(object sender, EventArgs e)
        {
            textBox43.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) / 1000);
            textBox44.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) / 1000000);
            textBox45.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) / 1000000000);
            textBox41.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) * 1000);
            textBox40.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) * 1000000);
            textBox39.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) * 1000000000);
            textBox38.Text = Convert.ToString(Convert.ToDecimal(textBox42.Text) * 1000000000000);
        }

        private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            switch (comboBox1.Text)
            {
                case "Siyah": pictureBox2.BackColor = System.Drawing.Color.Black; textBox1.Text = "0"; break;
                case "K.rengi": pictureBox2.BackColor = System.Drawing.Color.Brown; textBox1.Text = "1"; break;
                case "Kırmızı": pictureBox2.BackColor = System.Drawing.Color.Red; textBox1.Text = "2"; break;
                case "Turuncu": pictureBox2.BackColor = System.Drawing.Color.Orange; textBox1.Text = "3"; break;
                case "Sarı": pictureBox2.BackColor = System.Drawing.Color.Yellow; textBox1.Text = "4"; break;
                case "Yeşil": pictureBox2.BackColor = System.Drawing.Color.Green; textBox1.Text = "5"; break;
                case "Mavi": pictureBox2.BackColor = System.Drawing.Color.Blue; textBox1.Text = "6"; break;
                case "Mor": pictureBox2.BackColor = System.Drawing.Color.Purple; textBox1.Text = "7"; break;
                case "Gri": pictureBox2.BackColor = System.Drawing.Color.Gray; textBox1.Text = "8"; break;
                case "Beyaz": pictureBox2.BackColor = System.Drawing.Color.White; textBox1.Text = "9"; break;

            }
        }

        private void comboBox2_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            switch (comboBox2.Text)
            {
                case "Siyah": pictureBox3.BackColor = System.Drawing.Color.Black; textBox2.Text = "0"; break;
                case "K.rengi": pictureBox3.BackColor = System.Drawing.Color.Brown; textBox2.Text = "1"; break;
                case "Kırmızı": pictureBox3.BackColor = System.Drawing.Color.Red; textBox2.Text = "2"; break;
                case "Turuncu": pictureBox3.BackColor = System.Drawing.Color.Orange; textBox2.Text = "3"; break;
                case "Sarı": pictureBox3.BackColor = System.Drawing.Color.Yellow; textBox2.Text = "4"; break;
                case "Yeşil": pictureBox3.BackColor = System.Drawing.Color.Green; textBox2.Text = "5"; break;
                case "Mavi": pictureBox3.BackColor = System.Drawing.Color.Blue; textBox2.Text = "6"; break;
                case "Mor": pictureBox3.BackColor = System.Drawing.Color.Purple; textBox2.Text = "7"; break;
                case "Gri": pictureBox3.BackColor = System.Drawing.Color.Gray; textBox2.Text = "8"; break;
                case "Beyaz": pictureBox3.BackColor = System.Drawing.Color.White; textBox2.Text = "9"; break;

            }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://csharp-uygulamalari.blogspot.com.tr/");
        }
    }
}


Paylaş:

0 yorum:

Yorum Gönder

Popüler

Son

Kategoriler