Header Ads Widget

Responsive Advertisement

Final Çalışma

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

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text= " ";

            string al = textBox1.Text;

            foreach (string a in al.Split(' '))
                label1.Text += a + "\n";

            foreach(char a in al.ToCharArray())
                label1.Text += a + "\n";
        }
    }
}

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

        private void button1_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();
            foreach(Control abc in this.Controls)
            {
                abc.BackColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
                abc.ForeColor = Color.White;
                listBox1.Items.Add(abc.Name + "..." + abc.Text);
                if(abc is CheckBox)
                    (abc as CheckBox).Checked = true;
            }
        }

        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            listBox2.Items.Add(listBox1.SelectedItem);
            listBox1.Items.Remove(listBox1.SelectedItem);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            foreach(string a in listBox1.Items)
            {
                listBox2.Items.Add(a);
            }
            listBox1.Items.Clear();
        }
    }
}
namespace final_calisma_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        int i = 0;
        private void button1_Click(object sender, EventArgs e)
        {
            if(button1.Text == "Başlat")
            {
                i = 0;
                timer1.Enabled = true;
                button1.Text = "Durdur";
                listBox1.Items.Clear();
            }
            else
            {
                timer1.Enabled = false;
                button1.Text = "Başlat";
            }
            
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            listBox1.Items.Add(i++);
            label1.Text = (i).ToString();
            progressBar1.Value = i;
            if (i == 100)
            {
                i = 0;
            }
            label5.Text = "%" + i;

        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            timer1.Interval = trackBar1.Value;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            trackBar1.Minimum = 1;
            trackBar1.Maximum = 100;
            trackBar1.TickFrequency = 10;

            trackBar2.Minimum = 0;
            trackBar2.Maximum = 255;

            trackBar3.Minimum = 0;
            trackBar3.Maximum = 255;
            
            trackBar4.Minimum = 0;
            trackBar4.Maximum = 255;
        }

        private void trackBar2_Scroll(object sender, EventArgs e)
        {
            this.BackColor = Color.FromArgb(trackBar2.Value, trackBar3.Value, trackBar4.Value);
            label2.Text = "R(" + trackBar2.Value + ")";
        }

        private void trackBar3_Scroll(object sender, EventArgs e)
        {
            this.BackColor = Color.FromArgb(trackBar2.Value, trackBar3.Value, trackBar4.Value);
            label3.Text = "R(" + trackBar3.Value + ")";
        }

        private void trackBar4_Scroll(object sender, EventArgs e)
        {
            this.BackColor = Color.FromArgb(trackBar2.Value, trackBar3.Value, trackBar4.Value);
            label4.Text = "R(" + trackBar4.Value + ")";
        }
    }
}

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

        Button tut;
        private void mesaj(object sender, EventArgs e)
        {
            if(tut != null)
                tut.BackColor = Color.Red;
            
            foreach(Control a in this.Controls)
                if(a is Button)
                    a.BackColor = Color.Red;

            foreach (Control a in this.Controls)
                if (a is CheckBox)
                    if (a.Text == (sender as Button).Text)
                        (a as CheckBox).Checked = true;

            (sender as Button).BackColor = Color.DodgerBlue;
            tut = (sender as Button);

            string gonderen = (sender as Button).Text;
            MessageBox.Show(gonderen + ". Butona Tıklandı");
        }

        private void secim(object sender, EventArgs e)
        {
            string gonderen = (sender as CheckBox).Text;
            MessageBox.Show(gonderen + ". CheckBox'a Tıklandı");
        }

        int i = 20;
        int j = 0;
        int a = 1;


        private void button1_Click(object sender, EventArgs e)
        {
            Button bttn = new Button();
            bttn.Text = a.ToString();
            bttn.Left = 20 + j;
            bttn.Top= 20+i;
            bttn.BackColor = Color.Red;
            bttn.Click += new EventHandler(mesaj);
            this.Controls.Add(bttn);


            label1.Text = "Button Bottom: " + bttn.Bottom.ToString() + "\n"
            + "Form Height: " + Height.ToString() + "\n"
            + "Button Top: " + bttn.Top.ToString() + "\n"
            + "Button Left: " + bttn.Left.ToString() + "\n"
            + "Button Right: " + bttn.Right.ToString();

            CheckBox chc = new CheckBox();
            chc.AutoSize= false;
            chc.Size = new Size(40,20);
            chc.Text = a.ToString();
            chc.Left = 20 + j;
            chc.Top = 20 + i;
            chc.Click += new EventHandler(secim);
            this.Controls.Add(chc);

            if (bttn.Bottom + bttn.Height + 25 > this.Height)
            {
                i = 0;
                j += bttn.Width + 50;
            }

            i += 20;
            a++;
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}

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

        int i = 0;
        int j = 0;

        private void secim(object sender, EventArgs e)
        {
            foreach (Control a in this.Controls)
                if (a is TextBox)
                    label1.Text = (sender as TextBox).Text;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            TextBox txt = new TextBox();
            txt.Left = button1.Left + j;
            txt.Top = button1.Bottom + i;
            txt.KeyPress += new KeyPressEventHandler(tikla);
            txt.TextChanged += new EventHandler(calis);
            txt.KeyDown += new KeyEventHandler(al);
            i += 30;

            if (txt.Bottom > this.Height - 30 - 30)
            {
                i = 0;
                j += txt.Width + 30;
            }
            this.Controls.Add(txt);
        }

        private void tikla(object sender, KeyPressEventArgs e)
        {
            label1.Text = Convert.ToInt32(e.KeyChar).ToString();
        }

        private void calis(object sender, EventArgs e)
        {
            label1.Text = (sender as TextBox).Text;
        }

        private void al(object sender, KeyEventArgs e)
        {
            label1.Text = e.KeyCode.ToString();
            label2.Text = e.KeyValue.ToString();
        }
    }
}

Grafik Çizme

namespace final_calisma_son
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int x, y;
        bool ciziyor_mu = false;
        private void panel2_MouseMove(object sender, MouseEventArgs e)
        {
            Graphics graphics1 = this.panel2.CreateGraphics();
            SolidBrush solidBrush = new SolidBrush(Color.Red);
            if (ciziyor_mu)
            {
                graphics1.Clear(SystemColors.Control);
                graphics1.FillRectangle(solidBrush, x, y, e.X - x, e.Y - y);
            }
        }
        private void panel2_MouseUp(object sender, MouseEventArgs e)
        {
            ciziyor_mu = false;
        }
        private void panel2_MouseDown(object sender, MouseEventArgs e)
        {
            x= e.X;
            y= e.Y;
            ciziyor_mu = true;                                   
        }
        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            Graphics graphics = this.panel1.CreateGraphics();
            Pen pen = new Pen(Color.Red, 2);
            graphics.DrawLine(pen, e.X - 1, e.Y - 1, e.X, e.Y);
        }
    }
}

Yorum Gönder

0 Yorumlar

Oyun Haberlerinde Bugün

Xbox Series X'ten İlham Alan Mini Buzdolabı Xbox Mini Fridge Tanıtıldı.