From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
The picture displayed in the ImageWell. If you add the picture to the Project Editor, it will be listed in the drop-down menu in the Properties pane.
The following example displays an open-file dialog box that allows the user to choose a JPEG, or PNG file and display it in an ImageWell. It is assumed that the file types used as parameters in GetOpenFolderItem have been assigned in the File Type Sets Editor or with the FileType class via the language.
f = FolderItem.ShowOpenFileDialog(FileTypes1.All)
If f <> Nil Then
ImageWell1.Image = Picture.Open(f)
Drag and Drop
The following example implements drag and drop between two ImageWells, a jpeg file dragged from the desktop to either ImageWell, and from one ImageWell to the other.
In the Open event handler of the ImageWells, the two statements tell the controls to accept either a dragged picture or a dragged file of type jpeg. The file type "image/jpeg" was defined previously in the File Type Sets Editor.
The DropObject event handler is:
If obj.PictureAvailable then
Me.Image = obj.Picture
ElseIf obj.FolderItemAvailable Then
Me.Image = Picture.Open(obj.FolderItem)
The MouseDown event uses the DragItem constructor. It is: