در مورد متد ها ونحوه فراخوانی.
private void BiggerWindow()
{
this.Height += 200;
this.Width += 200;
}
private void button1_Click(object sender, EventArgs e)
{
BiggerWindow();
}
private void ChangeSizeForm(int x, int y)
{
this.Width = x;
this.Height = y;
}
private void ChangeSizeForm(string x, string y)
{
this.Width = Convert.ToInt16(x);
this.Height = Convert.ToInt16(y);
}
private void button2_Click(object sender, EventArgs e)
{
ChangeSizeForm(textBox1.Text, textBox2.Text);
}
private int sum(int x, int y)
{
return (x + y);
}
private int sum(int x, int y, int z)
{
return (x + y + z);
}
private void button3_Click(object sender, EventArgs e)
{
int a;
a = sum(12, 45, 2);
MessageBox.Show(a.ToString());
}
int a = 10, b = 5;
private void ShowIt()
{
label1.Text = a.ToString();
label2.Text = b.ToString();
}
private void Double1(int x, int y)
{
x *= 2; y *= 2;
}
private void Double2(ref int x, ref int y)
{
x *= 2; y *= 2;
}
private void button4_Click(object sender, EventArgs e)
{
Double1(a, b);
}
private void button5_Click(object sender, EventArgs e)
{
Double2(ref a, ref b);
}
private void button6_Click(object sender, EventArgs e)
{
ShowIt();
}