using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
char kierunek;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{//gora
kierunek='g';
}
private void timer1_Tick(object sender, EventArgs e)
{
if (kierunek== 'g')
pictureBox1.Top=pictureBox1.Top-10;
if (kierunek== 'p')
pictureBox1.Left=pictureBox1.Left+10;
if (kierunek== 'd')
pictureBox1.Top=pictureBox1.Top+10;
if (kierunek== 'l')
pictureBox1.Left=pictureBox1.Left-10;
if (kierunek== 's')
pictureBox1.Top=pictureBox1.Top-10;
}
private void button2_Click(object sender, EventArgs e)
{
kierunek='p';
}
private void button3_Click(object sender, EventArgs e)
{
kierunek='d';
}
private void button4_Click(object sender, EventArgs e)
{
kierunek='l';
}
private void button5_Click(object sender, EventArgs e)
{
kierunek = 's';
timer1.Enabled = false;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
char kierunek;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{//gora
kierunek='g';
}
private void timer1_Tick(object sender, EventArgs e)
{
/* if (kierunek== 'g')
pictureBox1.Top=pictureBox1.Top-10;
if (kierunek== 'p')
pictureBox1.Left=pictureBox1.Left+10;
if (kierunek== 'd')
pictureBox1.Top=pictureBox1.Top+10;
if (kierunek== 'l')
pictureBox1.Left=pictureBox1.Left-10;
if (kierunek== 's')
pictureBox1.Top=pictureBox1.Top-10;
*/
switch (kierunek)
{case 'g':
pictureBox1.Top=pictureBox1.Top+10;
break;
case 'd':
pictureBox1.Top=pictureBox1.Top-10;
break;
case 'l':
pictureBox1.Left=pictureBox1.Left-10;
break;
case 'p':
pictureBox1.Left=pictureBox1.Left+10;
break;
}
}
private void button2_Click(object sender, EventArgs e)
{
kierunek='p';
}
private void button3_Click(object sender, EventArgs e)
{
kierunek='d';
}
private void button4_Click(object sender, EventArgs e)
{
kierunek='l';
}
private void button5_Click(object sender, EventArgs e)
{
kierunek = 's';
timer1.Enabled = false;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
pictureBox1.Top = pictureBox1.Top - 10;
if (e.KeyCode == Keys.Down)
pictureBox1.Top = pictureBox1.Top + 10;
if (e.KeyCode == Keys.Left)
pictureBox1.Left = pictureBox1.Left - 10;
if (e.KeyCode == Keys.Right)
pictureBox1.Left = pictureBox1.Left + 10;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void kolorTłaToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void czarnyToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red;
}
private void zielonyToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Green;
}
private void duzeToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Width=500;
this.Height = 500;
}
private void maleToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Width = 150;
this.Height = 150;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void kolorTłaToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void czarnyToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red;
}
private void zielonyToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Green;
}
private void duzeToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Width=500;
this.Height = 500;
}
private void maleToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Width = 150;
this.Height = 150;
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void niebieskiToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.BackColor = Color.Blue;
}
private void zielonyToolStripMenuItem1_Click(object sender, EventArgs e)
{
richTextBox1.BackColor = Color.Green;
}
private void czerownyToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.BackColor = Color.Red;
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication8
{
public partial class Form1 : Form
{
Form2 okno2;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
okno2 = new Form2();
}
private void button2_Click(object sender, EventArgs e)
{
okno2.Show();
}
private void button3_Click(object sender, EventArgs e)
{
okno2.Hide();
}
private void button4_Click(object sender, EventArgs e)
{
okno2.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication8
{
public partial class Form1 : Form
{
Form2 okno2;
Form3 okno3;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
okno2 = new Form2();
}
private void button2_Click(object sender, EventArgs e)
{
okno2.Show();
}
private void button3_Click(object sender, EventArgs e)
{
okno2.Hide();
}
private void button4_Click(object sender, EventArgs e)
{
okno2.Dispose();
}
private void button5_Click(object sender, EventArgs e)
{
okno3 = new Form3();
}
private void button6_Click(object sender, EventArgs e)
{
okno3.ShowDialog();
}
private void button7_Click(object sender, EventArgs e)
{
okno3.Hide();
}
private void button8_Click(object sender, EventArgs e)
{
okno3.Dispose();
}
}
}