コード例 #1
0
        private void btnChooseF_Click(object sender, EventArgs e)
        {
            try
            {
                openFD.Title            = "Choose Image File";
                openFD.InitialDirectory = "C:";
                openFD.Filter           = "Jpeg|*.Jpg|Bitmap|*.bmp|Gif|*.gif";
                openFD.Multiselect      = false;
                openFD.ShowDialog();
                if (openFD.ShowDialog() == DialogResult.OK)
                {
                    // send picture file to resize method which returns resized picture to the picture box
                    Bitmap photo = (Bitmap)Image.FromFile(openFD.FileName);

                    PicBVideoImage.Image = RezieImageClass.ResizeImage(photo, 230, 191);
                    TxtFilePath.Text     = openFD.FileName;
                }
            }
            catch (BadImageFormatException ex)
            {
                MessageBox.Show(ex.Message.ToString(), ex.GetType().ToString());
            }
        }
コード例 #2
0
 public void display_imageData()
 {
     try
     {
         string value = CboVideos.Text;
         video = VideoDB.Select_by_Video_Name(value);
         Image image;
         if (video.ImageData != null)
         {
             MemoryStream memstr = new MemoryStream(video.ImageData);
             image = Bitmap.FromStream(memstr);
             image = RezieImageClass.ResizeImage(image, 230, 191);
             PicBVideoImage.Image = image;
         }
         else
         {
             MessageBox.Show("No Image was entered for this movie", "Image Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show("No Image was entered for this movie", "Image Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }