using System;
using System.Drawing;
using System.Windows.Forms;

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

        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox1.BackColor = Color.Blue;
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            //-------------------------------------------------
            openFileDialog1.Title = "Select File";
            openFileDialog1.FileName = string.Empty;
            openFileDialog1.InitialDirectory = "C:\\";
            openFileDialog1.Filter = "Picture Files (*.jpg)|*.jpg|All Files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = string.Empty;
            //----------------------------------------------------
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                pictureBox1.Load(openFileDialog1.FileName);
        }
    }
}