D:\1600100117\LAB2_1600100117\LAB2_1600100117\Form1.cs 1
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace LAB2_1600100117
12 {
13 public partial class Form1 : Form
14 {
15 public Form1()
16 {
17 InitializeComponent();
18 }
19
20 private void Form1_Load(object sender, EventArgs e)
21 {
22
23 }
24
25 private void button1_Click(object sender, EventArgs e)
26 {
27 int age;
28 age = Convert.ToInt32(numericUpDown1.Value);
29
30 if (age < 25)
31 {
32 if (male.Checked)
33 {
34 pictureBox2.Image = Properties.Resources.b1;
35 }
36 else if (female.Checked)
37 {
38 pictureBox2.Image = Properties.Resources.g1;
39 }
40 label5.Text = "อายย� ง� ไมม� ากเ�า� ไรนก� ออกกา� ลง� กายจะไ�แ� ขง� แรงนะคะ";
41 }
42 else if ((age >= 25) && (age < 60))
43 {
44 if (male.Checked)
45 {
46 pictureBox2.Image = Properties.Resources.b2;
47 }
48 else if (female.Checked)
49 {
50 pictureBox2.Image = Properties.Resources.g2;
51 }
52 label5.Text = "เป�นอาย�� �อยร� ะหวา� งวย� รน� ตอนตน� ตอนปลาย และวย� �ใ� ห�แ� ลว� นะคะ";
53 }
54 else if (age > 60)
55 {
56 if (male.Checked)
D:\1600100117\LAB2_1600100117\LAB2_1600100117\Form1.cs 2
57 {
58 pictureBox2.Image = Properties.Resources.b3;
59 }
60 else if (female.Checked)
61 {
62 pictureBox2.Image = Properties.Resources.g3;
63 }
64 label5.Text = "อายเ� ขา� ��วย� ชราแลว� ตอ� ง�แ� ล��ขภาพมากๆนะคะ";
65 }
66 }
67 }
68 }
69