0% found this document useful (0 votes)
2 views7 pages

Info

Uploaded by

VINCE BOJTHE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Info

Uploaded by

VINCE BOJTHE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

01 HELLOFORM

namespace _01HelloForm
{
public partial class HelloForm : Form
{
int db = 0;
public HelloForm()
{
InitializeComponent();
}

private void HelloForm_MouseClick(object sender, MouseEventArgs e)


{
//MessageBox.Show("VALAMI");
//this.BackColor = Color.Indigo;
Random r = new Random();
this.BackColor = Color.FromArgb(
r.Next(256),
r.Next(256),
r.Next(256));
db++;
Exit.ResetText();
Exit.Text = (10-db).ToString();
if(db == 10) Exit.Text = "Exit";
}

private void HelloForm_MouseMove(object sender, MouseEventArgs e)


{
if (e.Button == MouseButtons.Right)
this.Text = e.Location.ToString();
}

private void HelloForm_FormClosing(object sender, FormClosingEventArgs e)


{
if (db < 10)
{
e.Cancel = true;
MessageBox.Show("nem");
}
else e.Cancel = false;
}

private void Exit_Click(object sender, EventArgs e)


{
Application.Exit();
}
}
}

02 UGRALOFORM
namespace _02UgraloForm
{
public partial class UgraloForm : Form
{
public UgraloForm()
{
InitializeComponent();
}

private void Kozep_Click(object sender, EventArgs e)


{
Left = Screen.PrimaryScreen.Bounds.Width/2 - Width/2;
Top = Screen.PrimaryScreen.Bounds.Height / 2 - Height/2;
}
private void BalFel_Click(object sender, EventArgs e)
{
Left = 0;
Top = 0;
}

private void JobbFel_Click(object sender, EventArgs e)


{
Left = Screen.PrimaryScreen.Bounds.Width - Width;
Top = 0;
}

private void JobbLe_Click(object sender, EventArgs e)


{
Left = Screen.PrimaryScreen.Bounds.Width - Width;
Top = Screen.PrimaryScreen.Bounds.Height - Height;
}

private void BalLe_Click(object sender, EventArgs e)


{
Left = 0;
Top = Screen.PrimaryScreen.Bounds.Height - Height;
}
}
}

03 UGRALOGOMB
namespace _03UgraloGomb
{
public partial class UgraloGombok : Form
{
public UgraloGombok()
{
InitializeComponent();
}

private void NoButt_Click(object sender, EventArgs e)


{
MessageBox.Show("en is pont igy gondoltam", "by Manyika");
}

private void YeButt_MouseMove(object sender, MouseEventArgs e)


{
Random r = new Random();
YeButt.Top = r.Next(YeButt.Height, this.Height - YeButt.Height);
YeButt.Left = r.Next(YeButt.Width, this.Width - YeButt.Width);
}

private void Exit_MouseClick(object sender, MouseEventArgs e)


{
Application.Exit();
}

private void YeButt_MouseClick(object sender, MouseEventArgs e)


{
MessageBox.Show("Na jo na...");
}

}
}
04 CIMKEIGAZITAS
namespace _04Cimkeigazitas
{
public partial class Cimkeigazitas : Form
{
public Cimkeigazitas()
{
InitializeComponent();
}

private void Cimkeigazitas_Load(object sender, EventArgs e)


{
Szoveg.Top = 0;
Szoveg.Left = 0;
Szoveg.Height = this.ClientSize.Height;
Szoveg.Width = this.ClientSize.Width;
Szoveg.AutoSize = false;
Szoveg.BackColor = Color.MidnightBlue;
Szoveg.ForeColor = Color.White;
Szoveg.Text = "Oda ugrok ugrok ahova kattintasz";
Szoveg.Font = new Font("Arial", 15, FontStyle.Bold);
}

private void Cimkeigazitas_Resize(object sender, EventArgs e)


{
Szoveg.Top = 0;
Szoveg.Left = 0;
Szoveg.Height = this.ClientSize.Height;
Szoveg.Width = this.ClientSize.Width;
}

private void Szoveg_MouseClick(object sender, MouseEventArgs e)


{
int x = e.X / (Szoveg.Width / 3);
int y = e.Y / (Szoveg.Height / 3);
//MessageBox.Show(x.ToString() + " " + y.ToString());
int szam = 3 * y + x;
//5MessageBox.Show(szam.ToString());
switch (szam)
{
case 0: Szoveg.TextAlign = ContentAlignment.TopLeft; break;
case 1: Szoveg.TextAlign = ContentAlignment.TopCenter; break;
case 2: Szoveg.TextAlign = ContentAlignment.TopRight; break;
case 3: Szoveg.TextAlign = ContentAlignment.MiddleLeft; break;
case 4: Szoveg.TextAlign = ContentAlignment.MiddleCenter; break;
case 5: Szoveg.TextAlign = ContentAlignment.MiddleRight; break;
case 6: Szoveg.TextAlign = ContentAlignment.BottomLeft; break;
case 7: Szoveg.TextAlign = ContentAlignment.BottomCenter; break;
case 8: Szoveg.TextAlign = ContentAlignment.BottomRight; break;
}
}
}
}

05 BUJKAL
namespace _05Bujkal
{
public partial class Bujkalo : Form
{
public Bujkalo()
{
InitializeComponent();
}
private void lathatoleszek_MouseClick(object sender, MouseEventArgs e)
{
if(lathato.Visible)
{
lathato.Visible = false;
lathatoleszek.Text = "Lathato leszek";
} else
{
lathato.Visible = true;
lathatoleszek.Text = "Lathato vagyok";
}
}

private void meguntalak_MouseClick(object sender, MouseEventArgs e)


{
lathatoleszek.BackColor = Color.Gray;
lathatoleszek.Enabled = false;
}

private void Bujkalo_Load(object sender, EventArgs e)


{
lathato.Visible = true;
lathatoleszek.BackColor = Color.Blue;
}
}
}

06 EGERPOZICIO
namespace _06EgerPoz
{
public partial class EgerPoz : Form
{
public EgerPoz()
{
InitializeComponent();
}

private void EgerPoz_MouseMove(object sender, MouseEventArgs e)


{
int x = e.X;
int y = e.Y;

if(helabel.Left > this.ClientSize.Width / 2 - helabel.Width)


{
helabel.Top = y - helabel.Height;
helabel.Left = x - helabel.Width;
}
else
{
helabel.Top = y;
helabel.Left = x;
}

helabel.Text = x.ToString() + " " + y.ToString();


}
}
}

07 MERETEZ
namespace _07Meretez
{
public partial class Meretez : Form
{
public Meretez()
{
InitializeComponent();
}

private void PluszB_Click(object sender, EventArgs e)


{
Width = Width + 5;
Height = Height + 5;
}

private void MinuszB_Click(object sender, EventArgs e)


{
Width = Width - 5;
Height = Height - 5;

private void Meretez_Load(object sender, EventArgs e)


{
this.CenterToScreen();
}

private void Meretez_Resize(object sender, EventArgs e)


{
this.CenterToScreen();
}
}
}

08 DOBOZOK
namespace _08Dobozok
{
public partial class Dobozok : Form
{
public Dobozok()
{
InitializeComponent();
}

int leptek = 1;

private void BalLabel_MouseMove(object sender, MouseEventArgs e)


{
if(BalLabel.Top - leptek >= 0)
{
BalLabel.Top -= leptek;
JobbLabel.Top += leptek;
}
else
{
BalLabel.Top = ClientSize.Height - Ballabel.Height;
}

private void JobbLabel_MouseMove(object sender, MouseEventArgs e)


{
if(JobbLabel.Top - leptek >= 0)
{
JobbLabel.Top -= leptek;
BalLabel.Top += leptek;
}

}
private void Dobozok_Load(object sender, EventArgs e)
{
JobbLabel.Top = (ClientSize.Height - JobbLabel.Height)/2;
BalLabel.Top = (ClientSize.Height - BalLabel.Height)/2;
}
}
}

10 NOVELCSOKKENT
namespace _10NovelCsokkent
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

int leptek, db = 0;

private void Novel_Click(object sender, EventArgs e)


{
db += leptek;
Szamlalo.Text = db.ToString();
}

private void Egyes_Click(object sender, EventArgs e)


{
leptek = 1;
}

private void Kettes_Click(object sender, EventArgs e)


{
leptek = 3;
}

private void Harmas_Click(object sender, EventArgs e)


{
leptek = 5;
}

private void Form1_Load(object sender, EventArgs e)


{
leptek = 1;
db = 0;
}

private void Csokkent_Click(object sender, EventArgs e)


{
db -= leptek;
Szamlalo.Text = db.ToString();
}
}
}

11 SZINKEVERES
namespace _11Szinkeveres
{
public partial class Szinkeveres : Form
{
public Szinkeveres()
{
InitializeComponent();
}

private int r, g, b;

private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)


{
SzinL.Width = hScrollBar1.Value;
}

private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)


{
RL.Text = ("R " + hScrollBar2.Value).ToString();
r = hScrollBar2.Value;
SzinL.BackColor = Color.FromArgb(r, g, b);
}

private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)


{
GL.Text = ("G " + hScrollBar3.Value).ToString();
g = hScrollBar3.Value;
SzinL.BackColor = Color.FromArgb(r, g, b);
}

private void hScrollBar4_Scroll(object sender, ScrollEventArgs e)


{
BL.Text = ("B " + hScrollBar4.Value).ToString();
b = hScrollBar4.Value;
SzinL.BackColor = Color.FromArgb(r, g, b);
}

private void Szinkeveres_Load(object sender, EventArgs e)


{
SzinL.Width = 1;
SzinL.BackColor = Color.Gray;
}
}
}

12 SZINEZ
namespace _12Szinez
{
public partial class Szinez : Form
{
public Szinez()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
this.BackColor = (sender as Button).BackColor;
Label.Text = (sender as Button).BackColor.ToString();
}
}
}

You might also like