I’m trying to learn how to put a picture into an ImageWell.
On a new project I have placed ImageWell1 and Canvas1 objects.
I have performed SetFileTypes to setup file types for jpg and png files.
In the ImageWell Open action I have:
Me.AcceptPictureDrop
me.AcceptFileDrop(“image/jpeg”)
me.AcceptFileDrop(“image/png”)
In the ImageWell MouseDown action I have:
[code] Dim Myfile As FolderItem
Dim MyPicture As Picture
Dim resized as new picture( 200, 250 )
if IsContextualClick then
me.image = EmptyPic
return false
end
Myfile = GetOpenFolderItem(“image/png;image/jpeg”)
if MyFile <> nil then
MyPicture=Picture.Open(Myfile)
resized.graphics.drawpicture (MyPicture, 0, 0, 200, 250, 0, 0, MyPicture.width, MyPicture.height)
me.image = resized
end[/code]
So far so good. All of this works perfectly. I can click on the ImageWell and a file requester lets me choose a picture and it reads the picture and resizes it perfectly.
The problem comes in the DropObject action.
[code] Dim MyPicture As Picture
Dim resized as new picture( 200, 250 )
If Obj.PictureAvailable then
''me.image = Obj.Picture
'MyPicture = Obj.Picture
'me.DrawInto(MyPicture.Graphics,0,0)
'resized.graphics.drawpicture MyPicture, 0, 0, 200, 250, 0, 0, MyPicture.width, MyPicture.height
'me.image = resized
elseif Obj.FolderItemAvailable then
MyPicture = Picture.Open(obj.FolderItem)
resized.graphics.drawpicture (MyPicture, 0, 0, 200, 250, 0, 0, MyPicture.width, MyPicture.height)
me.image = resized
Canvas1.backdrop = resized
MsgBox(“folder item received”)
End if
[/code]
The problem is that when the MsgBox appears the picture in the ImageWell is perfect. Properly resized. And the picture in the Canvas shows properly resized.
But when I dismiss the MsgBox the picture in the ImageWell shows the picture hugely blown up (in its original size) as if it were being dropped into the ImageWell without being resized … but, of course, the picture in the Canvas still displays properly resized.
WHAT is causing it to revert to the non-resized picture?!?!?!