load pic, resize an put in backdrop

Hi,

i want to load a pic and scale it to the size of a canvas (into backdrop)

is this the right or is there a better way?

  dim p as Picture
  dim f as FolderItem = SpecialFolder.UserHome.Child("test.jpg")
  
  p=Picture.Open(f)
  dim p1 as new Picture(Canvas1.width,Canvas1.height)
  p1.Graphics.DrawPicture p,0,0,Canvas1.width,Canvas1.height,0,0,p.Width,p.Height
  
  if f <> nil then
    Canvas1.Backdrop = p1
  end if

Might want to check if F is nil BEFORE you attempt to open it, as well as checking if it EXISTS

yes, of course. i meant do i really have to create 2 pictures, one to load and a second for resizing?