Display bitmap on canvas

Hello,
i would like to display a bitmap image into canvas, any idea about this ?
the code for loading picture into pictureBox is different with Vb6.

It’s running properly with the following code:

  Dim picFile As FolderItem
  picFile = GetOpenFolderItem("")
  
  If picFile <> Nil Then
    Dim pic As Picture
    pic = Picture.Open(picFile)
    cvsGCPlot.Backdrop = pic
  End If

Can you tell me how did you finally solve it?

If there is something about the supplied solution you do not understand, ask a specific question

@Dave S,I want to upload bmp file on web page and display it,but I failed.

So post what you tried to do, and perhaps someone can point out where you went wrong. But asking if a solution was found, when one was presented, doesn’t allow us to know your situation is “different”

in the canvas open event i put this code :

[code]Dim picFile As FolderItem

picFile = GetFolderItem(“img.jpg”,2)

If picFile <> Nil Then
Dim pic As Picture
pic = Picture.Open(picFile)
canvas.Backdrop= pic
End If[/code]

You can store your img.jpg in folder (project), or in the root "C:" .

Isn’t Web different ?

It is a Desktop solution.

…

Thanks for your answer,I want to upload a bmp file(test.bmp) and show it,but GetPict is nil.
For Each file As WebUploadedFile In files
f = New FolderItem(file.Name)
Try
file.Save(f)
Catch e As IOException
// File Error, skip file
Continue
End Try
Next
GetPict = Picture.Open(f) //nil
open() doesn’t wolk

first off… even if it did work… you would only “get” the last picture
and since you have a Try/Catch … are you sure that it isn’t “skipping” all the files… since you “catch” just blindly continues with no feedback that a failure occured.

I don’t know.But when I try this code
Dim picFile As FolderItem
'picFile = GetFolderItem(“E:\Whole.bmp”)
picFile = GetFolderItem(“E:\1515758072045.jpeg”)
'picFile = GetFolderItem(“E:\BeerCan16.png”)
if picFile is nil then
break
end if

If picFile <> Nil Then
Dim pic As Picture
pic = Picture.Open(picFile) // bmp can’t open
ImageView1.Picture= pic
End If
have the same problem

How to display bmp file on webpage