using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ex01_12
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            treeView1.CollapseAll();   //折叠树的所有节点
        }

        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Text == "绿叶")
              {
                  pictureBox1.Image = Image.FromFile("01.jpg");
               }

            if (treeView1.SelectedNode.Text == "红花")
               {
                pictureBox1.Image = Image.FromFile("02.jpg");
               }

            if (treeView1.SelectedNode.Text == "春节快乐")
              {
                pictureBox1.Image = Image.FromFile("03.gif");
              }

            if (treeView1.SelectedNode.Text == "舞狮")
            {
                pictureBox1.Image = Image.FromFile("04.gif");
            }

            if (treeView1.SelectedNode.Text == "圣诞老人")
            {
                pictureBox1.Image = Image.FromFile("05.gif");
            }

            if (treeView1.SelectedNode.Text == "卡通人物")
            {
                pictureBox1.Image = Image.FromFile("06.gif");
            }

            if (treeView1.SelectedNode.Text == "跳舞的女孩")
            {
                pictureBox1.Image = Image.FromFile("07.gif");
            }
        }
    }
}
