In VJ++, create a Windows application. In the Java form, drag the WFC picturebox control and a button. In the button click event, put the following to call the Win FileOpen dialog to let you select the image to be displayed.
OpenFileDialog ofd = new OpenFileDialog();
ofd.setDefaultExt("bmp");
ofd.setFilter("BMP images(*.bmp)|*.bmp|JPG images (*.jpg)|*.jpg");
ofd.setFilterIndex(1);
ofd.setInitialDir("c:\\");
int dlgResult = ofd.showDialog();
if (dlgResult == DialogResult.OK) {
pictureBox1.setImage(new Bitmap(ofd.getFileName()));
}Written and compiled by Réal Gagnon ©1998-2005
[ home ]