27 Ekim 2015 Salı

C# Hesap Makinesi Yapımı





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 Hesap_Makinesi
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void butonlar_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            textBox1.Text += btn.Text;
         //Rakamların olduğu Butonları Tek Tek Seçip Click Eventini Açıyoruz..
        }

        private void button11_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
        }

        private void button12_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text.Length != 0)
                {
                    textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1);
                }
            }
            catch
            { }
        }
        double s1,s2;
        string isaret;
        private void oprtrButon_Click(object sender, EventArgs e)
        {
            //+,-,*,/,= ve % olan Butonları Tek Tek Seçip Click Eventini Açıyoruz..
            Button btn = (Button)sender;
            if (btn.Text == "+")
            {
                double.TryParse(textBox1.Text, out s1);
                isaret = btn.Text;
                textBox1.Clear();

            }
            else if (btn.Text == "-")
            {
                double.TryParse(textBox1.Text, out s1);
                isaret = btn.Text;
                textBox1.Clear();

            }
            else if (btn.Text == "/")
            {
                double.TryParse(textBox1.Text, out s1);
                isaret = btn.Text;
                textBox1.Clear();

            }
            else if (btn.Text == "*")
            {
                double.TryParse(textBox1.Text, out s1);
                isaret = btn.Text;
                textBox1.Clear();

            }
            else if (btn.Text == "%")
            {
                double.TryParse(textBox1.Text, out s1);
                isaret = btn.Text;
                textBox1.Clear();

            }
            if (btn.Text == "=")
            {
                double.TryParse(textBox1.Text, out s2);
                if (isaret == "+") textBox1.Text = (s1 + s2).ToString();
                if (isaret == "-") textBox1.Text = (s1 - s2).ToString();
                if (isaret == "*") textBox1.Text = (s1 * s2).ToString();
                if (isaret == "/") textBox1.Text = (s1 / s2).ToString();
                if (isaret == "%") textBox1.Text = (s1 % s2).ToString();
            }
        }

    }
}

Paylaş:

16 Ekim 2015 Cuma

15 Ekim 2015 Perşembe

C# İle Basit Paint Uygulaması



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 FikriPaint
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }



        string çizim = "Çizgi";//Radio Butonlar Çizgi,Dikdörtgen,Elips,Serbest
        private void arac_sec_CheckedChanged_1(object sender, EventArgs e)//4 RadioButonu da Seçip CheckedChanged eventine kodu yazıyoruz.
        {
            RadioButton rb = (RadioButton)sender;
            if (rb.Checked)
            {
                çizim = rb.Text;
            }
        }
        Point p1, p2;

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (çizim == "Serbest")
                {
                    Graphics g = this.CreateGraphics();
                    Pen kalem = new Pen(Color.Red, 4);
                    Point pt1 = new Point(e.X, e.Y);
                    Point pt2 = new Point(e.X + 1, e.Y + 1);

                    g.DrawLine(kalem, pt1, pt2);
                }
            }
        }

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            p1 = new Point(e.X, e.Y);
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            p2 = new Point(e.X, e.Y);

            Graphics g = this.CreateGraphics();
            Pen kalem = new Pen(Color.Red, 2);
            Rectangle dortgen = new Rectangle(p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y);
            SolidBrush fırça = new SolidBrush(Color.Yellow);

            if (çizim == "Çizgi")
                g.DrawLine(kalem, p1, p2);
            else if (çizim == "Dikdörtgen")
            {
                if (Tara.Checked)
                    g.FillRectangle(fırça, dortgen);
                g.DrawRectangle(kalem, dortgen);
            }
            else if (çizim == "Elips")
            {
                if (Tara.Checked)
                    g.FillEllipse(fırça, dortgen);
                g.DrawEllipse(kalem, dortgen);
            }
        }
    }
}

Paylaş:

PHP POST Yöntemiyle Veri Gönderme

form_post.php Sayfası

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form_Post</title>
</head>

<body>
<form id="form1" action="post_isle.php" method="POST">
<table width="480" style="background-color:#c9d2a2;">
<tr><td colspan="2" style="background-color:#bdbddf;">Üye Kayıt Formu</td></tr>
<tr><td width="120">Adınız:</td><td><input type="text" name="txtAd" size="24" value="" /></td></tr>
<tr><td width="120">E-Posta:</td><td><input type="text" name="txtEPosta" size="40" value="@" /></td></tr>
<tr><td width="120">Parolanız:</td><td><input type="password" name="txtParola" size="10" value="" /></td></tr>
<tr><td width="120">Adınız:</td><td><input type="submit" value="Gönder" /><input type="reset" value="Temizle" /></td></tr>
</table>
</form>
</body>
</html>


post_isle.php Sayfası

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Post_İsle</title>
</head>
<body>
<?php
if(isset($_POST["txtAd"]))$ad = $_POST["txtAd"];
if(isset($_POST["txtEPosta"]))$eposta = $_POST["txtEPosta"];
if(isset($_POST["txtParola"]))$parola = $_POST["txtParola"];
echo "Formdan <b>POST</b> Methoduyla Gelen Veriler <br>";
echo "<br>Ad:".$ad;
echo "<br>E-Posta:".$eposta;
echo "<br>Parola:".$parola;
?>
</body>
</html>
Paylaş:

PHP GET Yöntemiyle Veri Gönderme

form_get.php Sayfası

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form_Get</title>
</head>
<body>
<form id="form1" action="get_isle.php" method="get">
<table width="480" style="background-color:#c9d2a2;">
<tr><td colspan="2" style="background-color:#bdbddf;">Üye Kayıt Formu</td></tr>
<tr><td width="120">Adınız:</td><td><input type="text" name="txtAd" size="24" value="" /></td></tr>
<tr><td width="120">E-Posta:</td><td><input type="text" name="txtEPosta" size="40" value="@" /></td></tr>
<tr><td width="120">Parolanız:</td><td><input type="password" name="txtParola" size="10" value="" /></td></tr>
<tr><td width="120">Adınız:</td><td><input type="submit" value="Gönder" /><input type="reset" value="Temizle" /></td></tr>
</table>
</form>
</body>
</html>

get_isle.php Sayfası

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Get_İsle</title>
</head>
<body>
<?php
if(isset($_GET["txtAd"]))$ad = $_GET["txtAd"];
if(isset($_GET["txtEPosta"]))$eposta = $_GET["txtEPosta"];
if(isset($_GET["txtParola"]))$parola = $_GET["txtParola"];
echo "Formdan <b>GET</b> Methoduyla Gelen Veriler <br>";
echo "<br>Ad:".$ad;
echo "<br>E-Posta:".$eposta;
echo "<br>Parola:".$parola;
?>
</body>
</html>
Paylaş:

13 Ekim 2015 Salı

PHP ile Vize Final Not Hesabı

<form action="nothesaplama.php" method="get">
<div>Vize:<input type="text" name="txtVize" value="" /></div>
<div>Final:<input type="text" name="txtFinal" value="" /></div>
<div><input type="submit" value="Hesapla" /></div>
</form>

<?php
@$vize=$_GET["txtVize"];
@$final=$_GET["txtFinal"];
echo "Vize= $vize";
echo "<br>Final= $final";
$ortalama = ($vize * 0.4) + ($final * 0.6);
echo "<br>Ortalama= $ortalama";
if($ortalama >= 60 && $final >= 50)
{
echo "<br>GEÇTİ";
}
else
{
echo "<br>KALDI";
}

if($ortalama>=90 &&$ortalama<=100) $bn="AA";
if($ortalama>=85 &&$ortalama<90) $bn="BA";
if($ortalama>=80 &&$ortalama<85) $bn="BB";
if($ortalama>=75 &&$ortalama<80) $bn="CB";
if($ortalama>=65 &&$ortalama<75) $bn="CC";
if($ortalama>=58 &&$ortalama<65) $bn="DC";
if($ortalama>=50 &&$ortalama<58) $bn="DD";
if($ortalama>=0 &&$ortalama<50) $bn="FF";
switch($bn)
{
case "AA":$ks=4.0; break;
case "BA":$ks=3.5; break;
case "BB":$ks=3.0; break;
case "CB":$ks=2.5; break;
case "CC":$ks=2.0; break;
case "DC":$ks=1.5; break;
case "DD":$ks=1.0; break;
case "FF":$ks=0.0; break;
}
echo "<br>Harf Notu= $bn<br>Kat Sayısı= $ks";
?>
Paylaş:

11 Ekim 2015 Pazar

C# Müzik Çalar Yapımı



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;
using System.Runtime.InteropServices;
using System.IO;



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

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                String[] degerler = new String[] { };
                degerler = (File.ReadAllLines("D:\\ParcaListesi.txt"));
                for (int j = 0; j <= degerler.Length; j++)
                {
                    listBox1.Items.Add(degerler.GetValue(j));
                }
            }
            catch
            {
            }
            try
            {
                sahip1.Text = " Copyright Fikri KOCAOGLAN™";
                bilgilabel1.Text = "Listede Toplam " + listBox1.Items.Count + " Tane Parça Var.";
                listBox1.SetSelected(i, true);
            }
            catch
            { }
        }
        Random rnd = new Random();
        private void muzikcal()
        {
            try
            {
                if (listBox1.Items.Count != 0)
                {
                    if (radioButton1.Checked==true)
                    {
                        axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        i++;
                        listBox1.SetSelected(i, true);
                    }
                    else if (radioButton2.Checked == true)
                    {
                        axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        listBox1.SetSelected(rnd.Next(0, listBox1.Items.Count), true);
                    }
                }
                else
                {
                    MessageBox.Show("Önce Listeye Müzik Eklemelisiniz!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
            catch
            {

            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
         
            muzikcal();
            if (checkBox1.Checked)
            {
                if (listBox1.Items.Count != 0)
                {
                    timer1.Enabled = true;
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
                folderBrowserDialog1.ShowDialog();
                string yol = folderBrowserDialog1.SelectedPath;

                listBox1.Items.Clear();
                try
                {
                    foreach (string bulunandosya in Directory.GetFiles
                        (yol, "*.mp3", SearchOption.TopDirectoryOnly))
                        listBox1.Items.Add(bulunandosya);
                    listBox1.SetSelected(i, true);
                }
                catch
                {
                try
                {
                    foreach (string bulunandosya in Directory.GetFiles
                       (yol, "*.mp4", SearchOption.TopDirectoryOnly))
                        listBox1.Items.Add(bulunandosya);
                    listBox1.SetSelected(i, true);
                }
                catch
                {
                try
                {
                    foreach (string bulunandosya in Directory.GetFiles
                       (yol, "*.wav", SearchOption.TopDirectoryOnly))
                        listBox1.Items.Add(bulunandosya);
                    listBox1.SetSelected(i, true);
                }
                catch
                {
                try
                {
                    foreach (string bulunandosya in Directory.GetFiles
                       (yol, "*.avi", SearchOption.TopDirectoryOnly))
                        listBox1.Items.Add(bulunandosya);
                    listBox1.SetSelected(i, true);
                }
                catch
                {
                    MessageBox.Show("Herhangi bir Media Dosyası Bulunamadı!!!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                }
                }
                }
                bilgilabel1.Text = "Listede Toplam " + listBox1.Items.Count + " Tane Parça Listeye Eklendi.";
         
        }
        int i = 0;
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (listBox1.Items.Count != 0)
                {
                    if (radioButton1.Checked == true && checkBox1.Checked == false)
                    {
                        if (i > 0)
                        {
                            i--;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        }
                        else
                        {
                            i = listBox1.Items.Count - 1;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        }
                    }
                    else if (radioButton1.Checked == true && checkBox1.Checked == true)
                    {
                        if (i > 0)
                        {
                            timer1.Enabled = false;
                            i--;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                            timer1.Enabled = true;
                        }
                        else
                        {
                            timer1.Enabled = false;
                            i = listBox1.Items.Count - 1;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                            timer1.Enabled = true;
                        }
                    }
                    else
                    {
                        axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        listBox1.SetSelected(rnd.Next(0, listBox1.Items.Count), true);
                    }

                }
                else
                {
                    MessageBox.Show("Önce Listeye Müzik Eklemelisiniz!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
            catch
            {

            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (listBox1.Items.Count != 0)
                {
                    if (radioButton1.Checked == true && checkBox1.Checked == false)
                    {
                        if (i < listBox1.Items.Count - 1)
                        {
                            sayac++;
                            i++;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        }
                        else if (i == listBox1.Items.Count - 1)
                        {
                            i = 0;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        }
                    }
                    else if (radioButton1.Checked == true && checkBox1.Checked == true)
                    {
                        if (i < listBox1.Items.Count - 1)
                        {
                            timer1.Enabled = false;
                            i++;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                            timer1.Enabled = true;
                        }
                        else if (i == listBox1.Items.Count - 1)
                        {
                            timer1.Enabled = false;
                            i = 0;
                            listBox1.SetSelected(i, true);
                            axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                            timer1.Enabled = true;
                        }
                    }
                    else
                    {
                        axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();
                        listBox1.SetSelected(rnd.Next(0, listBox1.Items.Count), true);
                    }
                    if (radioButton1.Checked)
                    {
                        if (sayac == listBox1.Items.Count - 1)
                        {
                            timer1.Enabled = false;
                            MessageBox.Show("Tüm Müzikler Çalındı!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Önce Listeye Müzik Eklemelisiniz!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
            catch
            {

            }
        }
        int sayac = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            string kalanSure = axWindowsMediaPlayer1.Ctlcontrols.currentPositionString.ToString();
            string maxSure =  axWindowsMediaPlayer1.Ctlcontrols.currentItem.durationString;
            int maxx = Convert.ToInt32(axWindowsMediaPlayer1.Ctlcontrols.currentPosition);
            int kalann = Convert.ToInt32(axWindowsMediaPlayer1.Ctlcontrols.currentItem.duration);
            if (kalann == maxx)
            {
                sayac++;
                muzikcal();
            }
            if (radioButton1.Checked)
            {
                if (sayac == listBox1.Items.Count - 1)
                {
                    timer1.Enabled = false;
                    MessageBox.Show("Tüm Müzikler Çalındı!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
         
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
                timer1.Enabled = true;
            else
                timer1.Enabled = false;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.Ctlcontrols.stop();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.Count != 0)
            {
                FileStream fs = new FileStream("D:\\ParcaListesi.txt",
                    FileMode.Create, FileAccess.Write, FileShare.Write);
                StreamWriter sw = new StreamWriter(fs);
                for (int i = 0; i <= listBox1.Items.Count - 1; i++)
                    sw.WriteLine(listBox1.Items[i]);
                sw.Close();
                MessageBox.Show("Liste Kaydedildi!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                bilgilabel1.Text = "Listeye Toplam " + listBox1.Items.Count + " Tane Parça Eklendi.";

            }
            else
            {
                MessageBox.Show("Liste Boş!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Listeyi Silmek İstiyormusunuz?", "BİLGİ", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)==DialogResult.Yes)
                {
                    File.Delete("D:\\ParcaListesi.txt");
                    MessageBox.Show("Liste Silindi!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    listBox1.Items.Clear();
                    bilgilabel1.Text = "Listede Toplam " + listBox1.Items.Count + " Tane Parça Var.";

                }
                else
                {
                    MessageBox.Show("Liste Silme İşlemi İptal Edildi!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
            catch (Exception ex)
            { }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            try
            {
                sahip1.Text = sahip1.Text.Substring(1) + sahip1.Text.Substring(0, 1);
            }
            catch
            { }
        }
    }
}


Paylaş:

Popüler

Son

Kategoriler