ImageWell

From Xojo Documentation

Revision as of 18:55, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

Used to display an image in a window.


Super Class

RectControl

Because this is a RectControl, see the RectControl for other properties and events that are common to all RectControl objects.


Properties

Name Type Description
Image Picture The picture displayed in the ImageWell.


Notes

If QuickTime is installed on the user's machine, the additional picture formats supported by QuickTime are also supported. This pertains to Windows and Macintosh only. Native support for the following formats is provided:


Windows

On Windows, an ImageWell can display a BMP or PNG image.


Macintosh

On Macintosh, an ImageWell can display a PICT image.


Linux

On Linux, an ImageWell can display a BMP or PNG image.


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 BMP file dragged from the desktop to either ImageWell, and from one ImageWell to the other. For Macintosh, use the PICT file type instead of BMP.

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 BMP. The file type "image/x-bmp" was defined previously in the File Type Sets Editor or via the FileType class.

Me.AcceptFileDrop("image/x-bmp")

The DropObject event handler is

Sub DropObject(Obj as DragItem)
If Obj.PictureAvailable then
Me.Image=Obj.Picture
 elseif Obj.FolderItemAvailable then
Me.Image=Obj.FolderItem.OpenAsPicture
 End if

The MouseDown event uses the NewDragItem method of the Window class. It is

d=NewDragItem(Me.left,Me.top,Me.width,Me.height)
d.picture=Me.Image
d.Drag //Allow the drag


See Also

RectControl class; Canvas control.