Mega Code Archive

 
Categories / Delphi / Examples
 

Msg canvas does not allow drawing

Question: What does the error message 'Canvas does not allow drawing' mean? Answer: you may have run out of resources, which means a new DC cannot be allocated. Usually this is a result of not freeing unused DCs or other objects. you are attempting to draw to an device context that is not yet valid. Such as in the create constructor of a component. you are trying to draw on a canvas while your last draw-operation has not finished yet. In this case you can use Canvas.Lock() or Canvas.TryLock() to fix it.