ImageWell.Image

From Xojo Documentation

Property (As Picture )
aImageWell.Image = newPictureValue
or
PictureValue = aImageWell.Image

Supported for all project types and targets.

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.

Examples

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.

Dim f As FolderItem
f = GetOpenFolderItem(FileTypes1.All)
If f <> Nil Then
ImageWell1.Image = Picture.Open(f)
End If

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.

Me.AcceptPictureDrop
Me.AcceptFileDrop("image/jpeg")

The DropObject event handler is:

Sub DropObject(obj As DragItem)
If obj.PictureAvailable then
Me.Image = obj.Picture
ElseIf obj.FolderItemAvailable Then
Me.Image = Picture.Open(obj.FolderItem)
End If
End Sub

The MouseDown event uses the DragItem constructor. It is:

Dim d As DragItem
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
d.Picture = Me.Image
d.Drag
Return True // Allow the drag