Picture.Open

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Shared Method

Picture.Open(file As FolderItem) As Picture

Supported for all project types and targets.

Opens the passed FolderItem to be read as a Picture. Returns a Picture on success. If the FolderItem passed is nil, a NilObjectException is raised. If Picture.Open fails for any other reason, Nil is returned with no other error information.

Example

The following example prompts you to select a file and then opens it and displays it in an ImageWell:

Var picFile As FolderItem
picFile = FolderItem.ShowOpenFileDialog("")

If picFile <> Nil And picFile.Exists Then
Var pic As Picture
pic = Picture.Open(picFile)
ImageWell1.Image = pic
End If