C# - How To Browse An Image Into A PictureBox In C#

c# picturebox browse image

C# - How To Upload An Image Into A PictureBox In C#

____________________________________________________

In This C# Code We Will See How To Load An Image Into A pictureBox In  CSharp  Programming Language .




Project Source Code:

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

namespace WindowsFormsApplication1
{
    public partial class CSharp_Browse_Image_Into_PictureBox : Form
    {
        public CSharp_Browse_Image_Into_PictureBox()
        {
            InitializeComponent();
        }

        private void BtnBrowseImage_Click(object sender, EventArgs e)
        {

            OpenFileDialog opf = new OpenFileDialog();
            // chose the images type
            opf.Filter = "Choose Image(*.jpg;*.png;*.gif)|*.jpg;*.png;*.gif";

            if(opf.ShowDialog() == DialogResult.OK)
            {
                // get the image returned by OpenFileDialog 
                pictureBox1.Image = Image.FromFile(opf.FileName);
            }
        }
    }
}

OutPut :
c# load image into picturebox
C# Display Image Into PictureBox




Share this

Related Posts

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer