예제 #1
0
        private void btnChoosePoster_Click(object sender, EventArgs e)
        {
            //Code found at:
            //  Site Name: stackoverflow.com
            //  URL: http://stackoverflow.com/questions/24449988/how-to-get-file-path-from-openfiledialog-and-folderbrowserdialog

            //Variable Declarations.
            string imagePath = "";

            //Create and display an open file dialog box.
            //OpenFileDialog choofdlog = new OpenFileDialog();
            //choofdlog.Filter = "Image Files | *.jpg; *.png; *.bmp";

            ////Get the path of the file selected.
            //if (choofdlog.ShowDialog() == DialogResult.OK)
            //{
            //    //label1.Text = choofdlog.FileName;
            //    //pbMoviePoster.Image = choofdlog.FileName;

            //    pbMoviePoster.ImageLocation = choofdlog.FileName;
            //}

            //pbMoviePoster.ImageLocation = ApplicationUtilities.ChooseImageFile();

            try
            {
                //pbMoviePoster.ImageLocation = ApplicationUtilities.ChooseImageFile();
                imagePath = ApplicationUtilities.ChooseImageFile();
                if (imagePath != "")
                {
                    pbMoviePoster.ImageLocation = imagePath;
                }
            }
            catch (Exception ex)
            {
                ApplicationUtilities.CatchExceptions(ex);
            }
        }
 private void btnChoosePoster_Click(object sender, EventArgs e)
 {
     pbMoviePoster.ImageLocation = ApplicationUtilities.ChooseImageFile();
 }