Canvas per Newbie

Salve. Ho una CANVAS (ImageMember) di 150x150 px con settato un BACKDROP (una immagine di 150x150 px). Ho un tasto “Add Image” con un Event Handler Action:
Dim f As FolderItem
Dim d As OpenDialog
d = New OpenDialog
f = d.ShowModal()
If f <> Nil Then
MyPic = Picture.Open(f)
End If

Sul CANVAS ho settato un Event Handler Paint :
If MyPic <> Nil Then
g.DrawPicture(MyPic, 0, 0, g.Width, g.Height, 0, 0, MyPic.Width, MyPic.Height)
End If

  1. domanda: come elimino l’immagine di BACKDROP?

Ho un tasto “Clear All” con una EH Action:
AddressField.Text = “”
CityField.Text = “”
EmailField.Text = “”
FirstNameField.Text = “”
LastNameField.Text = “”
GradeField.Text = “”
MobileField.Text = “”
PhoneField.Text = “”
ZipCodeField.Text = “”
//MyPic = Nil

  1. domanda: come elimino l’immagine caricata e ricarico l’immagine di BACKDROP?
ImageMember.Backdrop = Nil

(If ImageMember is the Canvas name).

why not simple

If f <> Nil And f.Exists Then Canvas.Backdrop = Picture.Open(f)

Hi Axel. Danke für deine Hilfe. Ich habe das BACKDROP Imagedatei in einem Ordner in Xojo. Wie kann ich direkt die Datei laden ohne ein OpenDialog zu öffnen?

use the name that the image has in the IDE

Canvas.Backdrop = name_of_the_image

and to erase the image loaded into the canvas?

Canvas.Backdrop =  NIL

I meant I want to erase the image I have uploaded after erasing the BACKDROP
I already have:
If f <> Nil Then
MyPic = Picture.Open(f)
ImageMember.Backdrop = Nil
End If

In the CLEAR Action I want: ImageMember.Clear or so…
and then I have already: ImageMember.Backdrop = photocamera

a new backdrop removes the old backdrop

But the IMAGE is not the BACKDROP. After this in the CLEAR Action:
ImageMember.Backdrop = Nil
ImageMember.Backdrop = photocamera

I have two images: the BACKDROP and the image that I loaded with OpenDialog

Have you read the intro to programming book and the Xojo manual?
These two things will greatly help you as a new developer.

remove Code in Canvas.Paint