Southpaw Hare
Southpaw Hare

Reputation: 1593

Image on Canvas vs Label

What are the differences between using a Canvas control or a Label control for drawing an image?

Both controls seem to have similar capabilities in terms of drawing images onto their displayable area, and can both use PaintListeners to further customize the act. I have always assumed that Canvases are more suited for the purpose than labels simply due to their name, but I cannot determine the actual practical differences. In what scenarios would you use one over the other for loading an image file and painting the image onto the control?

Upvotes: 1

Views: 318

Answers (1)

renke
renke

Reputation: 1230

The Label inherits its drawing capabilities from Control, as well as many of the features in Canvas. But Canvas was built with extra controls for images, like dynamic drawing, buffering and partial update.

Summing up, it is ok to use labels for static small images, but when it comes to heavy-duty use, a canvas is more appropriate.

Upvotes: 3

Related Questions