public partial class Form1 : Form
{
public Form1()
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
label3.Text = "Размер";
label1.Text = "Количество";
label2.Text = "";
button1.Text = "Ok";
radioButton1.Checked = true;
button1.Enabled = false;
radioButton1.Text = "9 x 12";
radioButton2.Text = "12 x 15";
radioButton3.Text = "18 x 24";
private void button1_Click(object sender, EventArgs e)
double cena = 8.50;
int n;
double cuma;
if (radioButton1.Checked)
cena = 8.50;
if (radioButton2.Checked)
cena = 10.50;
if (radioButton3.Checked)
cena = 12.50;
n = Convert.ToInt32(textBox1.Text);
cuma = cena * n;
label2.Text = cuma.ToString("C");
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
if((e.KeyChar>='0')&&(e.KeyChar<='9'))
return;
if(char.IsControl (e.KeyChar))
if(e.KeyChar==(char) Keys.Enter)
button1.Focus();
e.Handled = true;
private void textBox1_TextChanged(object sender, EventArgs e)
if (textBox1.Text.Length == 0)
else
button1.Enabled = true;
private void radioButton1_Click(object sender, EventArgs e)
textBox1.Focus();
private void radioButton2_Click(object sender, EventArgs e)
private void radioButton3_Click(object sender, EventArgs e)
Объяснение:
Если на С#, то вот
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label3.Text = "Размер";
label1.Text = "Количество";
label2.Text = "";
button1.Text = "Ok";
radioButton1.Checked = true;
button1.Enabled = false;
radioButton1.Text = "9 x 12";
radioButton2.Text = "12 x 15";
radioButton3.Text = "18 x 24";
}
private void button1_Click(object sender, EventArgs e)
{
double cena = 8.50;
int n;
double cuma;
if (radioButton1.Checked)
cena = 8.50;
if (radioButton2.Checked)
cena = 10.50;
if (radioButton3.Checked)
cena = 12.50;
n = Convert.ToInt32(textBox1.Text);
cuma = cena * n;
label2.Text = cuma.ToString("C");
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if((e.KeyChar>='0')&&(e.KeyChar<='9'))
{
return;
}
if(char.IsControl (e.KeyChar))
{
if(e.KeyChar==(char) Keys.Enter)
{
button1.Focus();
}
return;
}
e.Handled = true;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text.Length == 0)
{
button1.Enabled = false;
}
else
{
button1.Enabled = true;
}
label2.Text = "";
}
private void radioButton1_Click(object sender, EventArgs e)
{
label2.Text = "";
textBox1.Focus();
}
private void radioButton2_Click(object sender, EventArgs e)
{
label2.Text = "";
textBox1.Focus();
}
private void radioButton3_Click(object sender, EventArgs e)
{
label2.Text = "";
textBox1.Focus();
}
}
Объяснение:
Если на С#, то вот