Form işlemleri

Örnek

Her saniye büyüyen bir form oluşturunuz.

this.Width += DateTime.Now.Second;
 this.Height += DateTime.Now.Second;

 if (DateTime.Now.Second == 0)
 {
     this.Width = 200;
     this.Height = 200;
 }

 

Örnek
Form işlemleriForm işlemleri
 
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            this.TopMost = true;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.CenterToScreen();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            this.ControlBox = false;
        }

        private void btnAccept_Click(object sender, EventArgs e)
        {
            label1.Text = "Enter tuşuna basıldı";
        }

        private void button9_Click(object sender, EventArgs e)
        {
            label2.Text = "Esc tuşuna basıldı";
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label3.Text = "Form 1 yüklendi.";
        }

        private void button7_Click(object sender, EventArgs e)
        {
            this.ShowDialog();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            Form formB = new Form();
            formB.ShowDialog();

        }

        private void button9_Click_1(object sender, EventArgs e)
        {
            FormC FormC = new FormC();
            FormC.ShowDialog();
        }
    }
}

 Örnek
Form işlemleri
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Osmankaraosman
{
    public partial class FormElma : Form
    {
        int Puan = 0;
        Random rnd = new Random();
        public FormElma()
        {
            InitializeComponent();
        }

        private void FormElma_Load(object sender, EventArgs e)
        {
            int sayi = rnd.Next(10, 20);
            label1.Text = "PUAN:";
            Puan = 0;

            for (int i = 0; i < sayi; i++)
            {
                PictureBox PB = new PictureBox();

                PB.Size = new Size(50, 50);
                PB.BackgroundImage = Properties.Resources.Elma;
                PB.Cursor = Cursors.Hand;
                PB.BackgroundImageLayout = ImageLayout.Stretch;
                ControlExtension.Draggable(PB, true);

                int x = rnd.Next(0, this.Width - 150);
                int y = rnd.Next(0, this.Height - 150);

                PB.Location = new Point(x, y);

                PB.MouseUp += (s, ev) =>
                {
                    if (PB.Bounds.IntersectsWith(pictureBoxCop.Bounds))
                    {
                        this.Controls.Remove(PB);
                        Puan++;

                        label1.Text = $"PUAN: {Puan}";
                    }
                };

                this.Controls.Add(PB);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
 
Veri.cs
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinFormsApp1
{
    internal class Veri
    {
    }
    class VeriTabanı
    {
        public static string Ad { get; set; }
        public static string Sifre {  get; set; }
        public static double EklenenBakiye { get; set; }
        public static double ToplamBakiye { get; set; }
        public static double HarcananBakiye { get; set;}
    }
}

 Oturum.cs
 
 
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 WinFormsApp1
{
    public partial class Oturum : Form
    {
        public Oturum()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == VeriTabanı.Ad && textBox2.Text == VeriTabanı.Sifre)
            {
                Hesap_Bilgileri HB = new Hesap_Bilgileri();
                HB.ShowDialog();
            }
            else
            {
                MessageBox.Show("Şifrenizi Yada Adınızı Eksik/Yanlış Girdiniz");
            }
        }

        private void Oturum_Load(object sender, EventArgs e)
        {
            ToolTip t = new ToolTip();
            t.SetToolTip(textBox1, "Adınızı Giriniz");
            t.SetToolTip(textBox2, "Şifrenizi Giriniz");
            t.SetToolTip(button1, "Oturum Açınız");
        }
    }
}
 
HesapBilgileri.cs
 
 
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 WinFormsApp1
{
    public partial class Hesap_Bilgileri : Form
    {
        public Hesap_Bilgileri()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                VeriTabanı.EklenenBakiye = Convert.ToDouble(textBox1.Text);
                VeriTabanı.ToplamBakiye += VeriTabanı.EklenenBakiye;

                label3.Text = "Banka Hesabı: " + VeriTabanı.ToplamBakiye.ToString();
            }
            catch
            {
                MessageBox.Show("Lütfen Para Girişini Sayılarla Yapınız.");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show($"Banka Sahibi = {VeriTabanı.Ad} | Banka Durumu = {VeriTabanı.ToplamBakiye} | En Son Eklenen Bakiye = {VeriTabanı.EklenenBakiye}");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (VeriTabanı.ToplamBakiye >= VeriTabanı.HarcananBakiye)
            {
                VeriTabanı.HarcananBakiye = Convert.ToDouble(textBox2.Text);
                VeriTabanı.ToplamBakiye -= VeriTabanı.HarcananBakiye;

                label3.Text = "Banka Hesabı: " + VeriTabanı.ToplamBakiye.ToString();
            }
            else
            {
                MessageBox.Show("Banka Hesabınızda Yeterli Para Yok");
            }
        }

        private void Hesap_Bilgileri_Load(object sender, EventArgs e)
        {
            ToolTip TP = new ToolTip();
            TP.SetToolTip(textBox1, "Para Girişi Buraya Yapınız");
            TP.SetToolTip(textBox2, "Borsaya Yatırmak İçin Para Değeri Giriniz");
            TP.SetToolTip(button1, "Para Yatırma İşlemi İçin Basınız");
            TP.SetToolTip(button2, "Banka Bilgilerini Görüntülemek İçin Basınız");
            TP.SetToolTip(button3, "Borsa Alımı İşlemi İçin Basınız");
        }
    }
}

 Osman Karaosman

Yükleniyor...

Yükleniyor...