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 Ex02_3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str;
            openFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";     //设置打开图像的类型
            openFileDialog1.ShowDialog();                        //打开对话框
            str = openFileDialog1.FileName;
            pictureBox1.Image = Image.FromFile(str);            //显示打开图像
        }

        private void button2_Click(object sender, EventArgs e)
        {
            pictureBox1.Width = Convert.ToInt32(pictureBox1.Width * 1.2);
            pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 1.2);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            pictureBox1.Width = Convert.ToInt32(pictureBox1.Width * 0.8);
            pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 0.8);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Image myi = pictureBox1.Image;
            myi.RotateFlip(RotateFlipType.Rotate180FlipY);
            pictureBox1.Image = myi;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Image myi = pictureBox1.Image;
            myi.RotateFlip(RotateFlipType.Rotate180FlipX);
            pictureBox1.Image = myi;
        }
    }
}
