ImageWell

From Xojo Documentation
Jump to: navigation, search

Class (inherits from RectControl)

Used to display an image in a window.


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


Properties
Active ReadOnlyProperty.png LockBottom Parent
AutoDeactivate LockLeft Scope ReadOnlyProperty.png
Enabled LockRight TabIndex
Handle ReadOnlyProperty.png LockTop TabStop
Height MouseCursor Top
HelpTag MouseX ReadOnlyProperty.png TrueWindow ReadOnlyProperty.png
Image MouseY ReadOnlyProperty.png Visible
Index ReadOnlyProperty.png Name Width
Left PanelIndex Window ReadOnlyProperty.png


Notes

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


Examples

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.

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


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

See Also

RectControl class; Canvas control.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About