Slow in loading Canvas Image

Hi all,

I have 6 Canvas in a webpage (which is the main page after user login), each canvas will load an image (all under 60KB png) with some text. Every time the user logins, it takes 2 to 3 seconds to have all the canvas loading complete. It can be easily seen that each image is loading one by one. Anything I can do to speed this up? Thanks in advance.

If this is the same code from your other question, I have a suggestion. For all of the pics which done change with every paint event, make a property of type WebPicture on the page, load the picture into that and then use the WebPicture instance in the drawpicture call. The way you’re doing it now, a new WebPicture is created each time and the canvas thinks it’s changing each time.

Hi Greg,

Just make sure I do not get it wrong. Do you mean I need to create 6 properties of type WebPicture and assign the picture to these 6 properties. Then use these 6 properties in all WebCanvas.paint?

  //old code
  //dim p as picture = imgLogo
  //g.DrawPicture(p, 30, 22, 152, 55)

  g.DrawPicture(imgLogoInstance, 30, 22, 152, 55)

Yes.

I did try but it gives the same speed. I will try to change to use WebImage to see if any difference.

Changing to use WebImage instead of WebCanvas to show images speeds up a lot. The only drawback is I have to create 2 controls, 1 Image and 1 Canvas for each item.

@Tony Lam I think you meant to accept Greg’s answer didn’t you?

Greg’s answer is a better explanation for people looking to solve the same issue.