open Images in Picture box using open dialog
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
image__picturebox
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
OpenFileDialog
opndlg = new OpenFileDialog();
opndlg.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg;
*.jpeg; *.gif; *.bmp";
if
(opndlg.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(opndlg.FileName);
this.Text
= opndlg.FileName;
}
}
}
}
No comments:
Post a Comment