DrawPicture In WebCanvas

I Tried to change dynamically an image in a WebCanvas using DrawPicture in the Pain Event.
Works fine if the picture is an image contained in the project i.e. a fixed image included in the executable image.

Does not work at all when loading an image external to the project like, for example, an image loaded from disk.
In this case the image is fine and I can see it in the debugger but this does not produce a picture on the web page rendered by the browser.

Is this a known limit or maybe a bug of the WebCanvas object?
I don’t see anything related to this topic in the documentation stating this behavior.



I’m not aware of any bugs like this. Could you show an example of the code you are using to load the picture and then the code you are using with DrawPicture?

Thank you Greg for your prompt reply.

I’m using the demo application EECanvasChart as base project.
In the Paint event of the GraphCanvas control I made this changes:

#if False

g.DrawPicture(EELogo, logoX, logoY)


dim f as FolderItem = GetFolderItem("c:\\myimage.png")
dim p as picture
p = picture.Open(f)
g.DrawPicture(p, logoX, logoY)


You might try making your picture property into a property of the class or window. It may be that it’s going out of scope before the picture gets drawn.

Thank you Greg, it works.

My fault.


Pictures are tricky because they require another round trip to the server. Check out the eeweb example, the picture on the chart appears a moment after the chart first draws.

My recommendation would be to preload any images you are going to use on a canvas to the client before you draw them. That guarantees the canvas has the image and can draw it immediately.