From Xojo Documentation

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

Class (inherits from RectControl)

Used to display an image in a window.

Close DropObject MouseMove
ConstructContextualMenu KeyDown MouseUp
ContextualMenuAction KeyUp MouseWheel
DragEnter MouseDown Open
DragExit MouseEnter
DragOver MouseExit

Active fa-lock-32.png LockLeft TabIndex
AllowAutoDeactivate LockRight Tooltip
AllowTabStop LockTop Top
Enabled MouseCursor Transparent
Handle fa-lock-32.png MouseX fa-lock-32.png TrueWindow fa-lock-32.png
Height MouseY fa-lock-32.png Visible
Image Name fa-lock-32.png Width
Index fa-lock-32.png PanelIndex Window fa-lock-32.png
Left Parent
LockBottom Scope fa-lock-32.png


Refer to the Picture class to see what image formats are supported for each platform.


The following line of code in the ImageWell’s Open event displays a picture of a prancing stallion in the ImageWell. The image had been added to the Project Editor.

Me.Image = Ferrari

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:

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:

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

See Also

RectControl class; Canvas control.