Skocz do zawartości

supergosc44

Użytkownik
  • Liczba zawartości

    2
  • Rejestracja

  • Ostatnia wizyta

Posty dodane przez supergosc44

  1. 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 Los
    {
        public partial class Form1 : Form
        {
     
            int ileRazyklik = 0;
            public Form1()
            {
                InitializeComponent();
                  this.Size = Screen.GetBounds(this).Size;
                  this.Width = Screen.GetBounds(this).Width;
                  this.Location = new Point(0, 0);
            }
     
            private void Klik_Click(object sender, EventArgs e)
            {
                ileRazyklik++;
                MessageBox.Show("Kliknięto: " + ileRazyklik.ToString(), "Wygrana", MessageBoxButtons.OK, MessageBoxIcon.Information);
     
            }
     
            int k = 0;
            string tytul = "Los";
     
            private void timer1_Tick(object sender, EventArgs e)
            {
                switch (++k)
                {
                    case 1: this.Text = tytul + "Trafionych " + ileRazyklik; break;
                    case 2: this.Text = tytul + DateTime.Now.ToString(); break;
                    case 3: this.Text = tytul + " " + Klik.Location.ToString(); k = 0; break;
     
                }
     
            }
     
            private void Klik_MouseEnter(object sender, EventArgs e)
            {
                wylosuj();
            }
     
            Random rand = new Random();
            int x, y;
     
            private void Form1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyData.Equals(Keys.Escape)) this.Close();
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
     
            }
     
            private void wylosuj()
            {
                x = rand.Next(this.Width - Klik.Width);
                y = rand.Next(this.Height - Klik.Height);
                Klik.Location = new Point(x, y);
            }
        }
    }
     

     

    private void textBox1_DragDrop(object sender, DragEventArgs e)
            {
                DialogResult wynik = MessageBox.Show("Czy zapisać przed zakonczeniem", "Error", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
     
                if (wynik == DialogResult.OK) zapiszToolStripMenuItem_Click(null, null);
                if (wynik == DialogResult.Cancel) return;
     
                string[] drop = (string[])e.Data.GetData(DataFormats.FileDrop);
                string nazwapliku = drop.Last();
                textBox1.Text = otworz(nazwapliku);
                aktualizuj(nazwapliku);
                Status = "Otwarto plik: " + nazwapliku;
            }

     private void textBox1_DragDrop(object sender, DragEventArgs e)
            {
                DialogResult wynik = wiadomosc();
                switch( wynik )
                {
                    case DialogResult.OK: zapiszToolStripMenuItem_Click(null, null);  break;
                    case DialogResult.No : return;
     
                }
     
     
                string[] drop = (string[])e.Data.GetData(DataFormats.FileDrop);
                string nazwa = drop.Last();
                textBox1.Text = czytajplik(nazwa);
                aktualizuj(nazwa);
                Status = "Otwarto " + nazwa;
            }
     
    private void textBox1_DragEnter(object sender, DragEventArgs e)
            {
                e.Effect = DragDropEffects.Move;
            }

     

  2. 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 Los
    {
        public partial class Form1 : Form
        {
     
            int ileRazyklik = 0;
            public Form1()
            {
                InitializeComponent();
                  this.Size = Screen.GetBounds(this).Size;
                  this.Width = Screen.GetBounds(this).Width;
                  this.Location = new Point(0, 0);
            }
     
            private void Klik_Click(object sender, EventArgs e)
            {
                ileRazyklik++;
                MessageBox.Show("Kliknięto: " + ileRazyklik.ToString(), "Wygrana", MessageBoxButtons.OK, MessageBoxIcon.Information);
     
            }
     
            int k = 0;
            string tytul = "Los";
     
            private void timer1_Tick(object sender, EventArgs e)
            {
                switch (++k)
                {
                    case 1: this.Text = tytul + "Trafionych " + ileRazyklik; break;
                    case 2: this.Text = tytul + DateTime.Now.ToString(); break;
                    case 3: this.Text = tytul + " " + Klik.Location.ToString(); k = 0; break;
     
                }
     
            }
     
            private void Klik_MouseEnter(object sender, EventArgs e)
            {
                wylosuj();
            }
     
            Random rand = new Random();
            int x, y;
     
            private void Form1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyData.Equals(Keys.Escape)) this.Close();
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
     
            }
     
            private void wylosuj()
            {
                x = rand.Next(this.Width - Klik.Width);
                y = rand.Next(this.Height - Klik.Height);
                Klik.Location = new Point(x, y);
            }
        }
    }
     

     

    private void textBox1_DragDrop(object sender, DragEventArgs e)
            {
                DialogResult wynik = MessageBox.Show("Czy zapisać przed zakonczeniem", "Error", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
     
                if (wynik == DialogResult.OK) zapiszToolStripMenuItem_Click(null, null);
                if (wynik == DialogResult.Cancel) return;
     
                string[] drop = (string[])e.Data.GetData(DataFormats.FileDrop);
                string nazwapliku = drop.Last();
                textBox1.Text = otworz(nazwapliku);
                aktualizuj(nazwapliku);
                Status = "Otwarto plik: " + nazwapliku;
            }
×
×
  • Dodaj nową pozycję...