C# Visual Studio Telefon Bilgileri

Merhabalar bu yazımda sizlere Microsoft Visual Studio' da C Sharp programlama dilini kullanarak seçtiğimiz marka ve modele göre telefonun birkaç adet bilgisini göstereceğiz.

Programımızı yapmak için belli bir form üzerinden gitmemiz gerekiyor ki daha iyi anlayabilin.
programın resmi
Yukarıda 2 adet combobox, 5 tane görünür label ve 3 tane de marka ve model seçtikten sonra görünecek olan labelimiz var. İşlemci, RAM ve ekran bilgisinin yanında olacak. Ve bir adet de picturebox kullanarak tamamlanmış hali aşağıdaki gibi olacak bir program yapacağız.
Aşağıda kodları bulabilirsiniz. Ama önce picturebox ımızın üstüne bir kere tıklayıp üstte çıkan Picturebox Tasks butonuna tıklayarak Choose Image tan telefonlarımız için resimleri seçiyoruz. İşte buradan:

Formumuzdaki işlemleri bitirdiğimize göre işte aşağıda kodlarımız.


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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        string[] asusMarka = { "Zenfone 3", "Zenfone ZOOM S", "Zenfone 2 Laser" };
        string[] genmobMarka = { "GM6", "GM5", "GM5 Plus" };

        public Form1()
        {
            InitializeComponent();
            comboBox1.SelectedItem = "ASUS";

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            if (comboBox1.SelectedItem.ToString() == "ASUS")
            {
                comboBox2.Items.AddRange(asusMarka);
            }
            else if (comboBox1.SelectedItem.ToString() == "General Mobile")
            {
                comboBox2.Items.AddRange(genmobMarka);
            }

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string model = comboBox2.SelectedItem.ToString();
            switch (model)
            {
                case "Zenfone 3":
                    Zenfone3();
                    break;
                case "Zenfone ZOOM S":
                    ZOOMS();
                    break;
                case "Zenfone 2 Laser":
                    Laser();
                    break;
                case "GM6":
                    GM6();
                    break;
                case "GM5":
                    GM5();
                    break;
                case "GM5 Plus":
                    GM5P();
                    break;

            }

        }
        public void Zenfone3()
        {
            lblCPU.Text = "64 - bit Qualcomm® Octa - Core ProcessorSnapdragon™ 625 @2.0Ghz";
            lblRAM.Text = "3 GB / 4 GB LPDDR3";
            lblEKRAN.Text = "5.5 Inch";
            pictureBox1.Image = Properties.Resources.zenfone_3;
        }
        public void ZOOMS()
        {
            lblCPU.Text = "Qualcomm® Octa-Core Processor Snapdragon™ 625 @2.0Ghz";
            lblRAM.Text = "4 GB";
            lblEKRAN.Text = "5.5 Inch";
            pictureBox1.Image = Properties.Resources.zooms;
        }
        public void Laser()
        {
            lblCPU.Text = "Qualcomm Snapdragon 615 MSM8939";
            lblRAM.Text = "2 GB";
            lblEKRAN.Text = "6 Inch";
            pictureBox1.Image = Properties.Resources._2laser;
        }

        public void GM6()
        {
            lblCPU.Text = "MediaTek MT6737T, 64bit Quad Core 1.5 GHz";
            lblRAM.Text = "3 GB";
            lblEKRAN.Text = "5 Inch";
            pictureBox1.Image = Properties.Resources.GM6;
        }
        public void GM5()
        {
            lblCPU.Text = "Qualcomm 1,2 GHz X 4 (64bit) işlemci";
            lblRAM.Text = "2 GB";
            lblEKRAN.Text = "5 Inch";
            pictureBox1.Image = Properties.Resources.gm5;
        }
        public void GM5P()
        {
            lblCPU.Text = "Qualcomm MSM8952 Snapdragon 617";
            lblRAM.Text = "3 GB";
            lblEKRAN.Text = "5.5 Inch";
            pictureBox1.Image = Properties.Resources.GM5PL;
        }

        
    }
}

Yorum Gönder

0 Yorumlar