2. Form1 will appear:
3. On the Properties in right side, change Text Form1 to Open Image.
4. Select View > Toolbox
5. Drag and drop button and pictureBox to the form as shown below: 6. On the Properties in right side, change Text button1 to Open Image.
7. On the Properties in right side, change SizeMode Normal to StretchImage.
8. Double-click on Open Image button
9. Copy paste code below as shown below:
OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog();
openFileDialog1->Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
openFileDialog1->Title = "Select a Image File";
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
pictureBox1->Image=pictureBox1->Image->FromFile(openFileDialog1->FileName);
}
No comments:
Post a Comment