nakash
nakash

Reputation:

PictureBox question

Using C#.Net

On my form i have a button that opens a dialog which allows a customer to select a picture, when the ok button is clicked the picture should be visible in the ultrapicture box control on the form..Not sure how to achieve this or if its simple a property to be set, any ideas ?

Upvotes: 0

Views: 722

Answers (1)

Tamás Szelei
Tamás Szelei

Reputation: 23921

Something like this:

DialogResult dr = openFileDialog1.ShowDialog();
if ( dr == DialogResult.OK )
{
      Image pic = Image.FromFile( openFileDialog1.FileName );
      pictureBox1.Image = pic;
}

Guessing that "ultrapicture box control" is a System.Windows.Forms.PictureBox descendant.

Upvotes: 7

Related Questions