From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
New in 2021r3
Used to display an image in a window.
Refer to the Picture class to see what image formats are supported for each platform.
The following line of code in the Opening event of a DesktopImageViewer displays a picture of a prancing stallion. The image had been added to the Project Editor.
The following example implements drag and drop between two DesktopImageViewers, a jpeg file dragged from the desktop to either DesktopImageViewer, and from one DesktopImageViewer to the other.
In the Opening event handler of the DesktopImageViewers, 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:
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
d.Picture = Me.Image
Return True // Allow the drag