Hello,
i try to use a drag and drop picture in a canvas1 in a window … and nothing appears , ( i have a property mImage as picture)
my code as follow :
in canvas1 paint
if app.mImage<> nil then
g.DrawPicture(app.mImage, 0,0, g.Width, g.Height, 0,0,app.mImage.Width, app.mImage.Height)
g.ForeColor = &cA1CBFF
g.DrawRect( 0, 0, g.Width, g.Height )
end if
in canvas1 open
Me.AcceptPictureDrop
me.AcceptFileDrop (“image/jpeg”)
me.AcceptFileDrop (“image/gif”)
me.AcceptFileDrop (“image/x-bmp”)
in canvas1 drop object
If Obj.PictureAvailable then
app.mImage=obj.picture
Elseif Obj.FolderItemAvailable then
app.mImage=Obj. FolderItem.OpenAsPicture
end if
I don’t understand what is wrong , i think my code is correct but…nothing in my canvas1 appears
Thks for your help
I’m very disapointed …
i had worked on similar code in the same computer , and its worked perfecly , i have found the old programm an i’m trying , it works great ,
but now when i want to do the same thing in a new program … its dont work …
what is wrong ?
And, sa Dave suggested as part of the the drop tell the canvas it should redraw itself the next time (otherwise there’s no reason for PAINT to get called) - you could also have deactivated the window, moved another in front of it and then reactivated it and it would have redrawn in canvas1 drop object
If Obj.PictureAvailable then
app.mImage=obj.picture
me.invalidate // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Elseif Obj.FolderItemAvailable then
app.mImage=Obj. FolderItem.OpenAsPicture
me.invalidate // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
end if