Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Msg 'Canvas does not allow drawing'
13 comments. Current rating: (4 votes). Leave comments and/ or rate it.
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.
Comments:
|
|
|
|
Thanks
|
|
|
|
|
To be honest, I'm not sure what it means, however, I feel that it may mean that a particular site does not want you downloading their images.
|
|
|
|
|
This Happens when you continuely Create a kind of Form dynamicly,You may Add some Delay among the Creations.
|
|
|
|
|
This issue happened to me when I was trying to use ShowMessage inside a thread's Execute method. It didn't happen when I stepped through the code, only when running it without breakpoints. Odd. I guess the ShowMessage function is not thread safe, or something.
|
|
|
|
|
i need to know what DC stands for because i get thie error message saying canvas does not allow drawing and i cant figure out why it keeps doing this and it freezing up on me. and i dont know whats going on. i just like to know how to get rid of it
|
|
|
|
|
The problem is on GetAveCharSize function, you need to change line 128 of dialogs.pas from
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
to:
If IsMultiThread Then
Canvas.Lock;
Try
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
Finally
If IsMultiThread Then
Canvas.Unlock;
End;
After this change, showmessage, inputbox and messagedlg become 'BeginThread' friendly... (Since BeginThread sets IsMultiThread to true...)
I do some test into running activescript in a thread, and get this canvas errors often with all boxes from dialogs, i test with my own copy of dialogs (called messageboxes) and the errors still occurred.
After this change, i test and do not see the canvas errors again. (yes, I DIG deeply into VCL to find... lol... 'CreateHandle' of TControlCanvas try to 'free' some handles when the internal list becomes full... if can 'lock' it... sometimes... he free ITSELF... causing null handle and this errors... only on multithread applications... off course...
|
|
|
|
|
At my system this occered when ASUS probe was running. After deleting ASUS probe no problems anymore.
|
2007-06-24, 17:06:36 (updated: 2007-06-24, 17:07:42) |
|
|
|
Hi, today I purchased Digital Picture Recovery to recover digital picture that have been lost o my computer. After scanning my hard-drive you have to select which picture you want to recover, but then disaster strikes: I get the message: Canvas doe not allow drawing.
Dos anyone knows what the problem is and what can be done about it??
|
|
|
|
|
i am trying to run few things in my thread which initiate a form object , so i am getting the error in the Create line of my code.
I could not figure out where to place the TryLock/Lock . so can you help me in this regard.
|
2008-02-08, 04:38:29 (updated: 2008-02-08, 04:39:56) |
|
|
|
Ativar a propriedade
panel: TPanel
panel.DoubleBuffered := True;
|
|
|
|
|
I found that if you turn off Asus Prob, the Msg 'Canvas does not allow drawing' will stop.
|
|
|
|
|
amigos tem um programa que da esse erro canvas does not allon drawing, so que no windows 98 ele roda normal quando passo para o windows xp, e que da esse erro, como faço para corrigi esse erro.
|
|
|
|
|
I just fix My problem with 'Canvas does not allow',
that's because I draw the canvas in event Timer,
I just add Canvas.lock at the Timer begin
and Canvas.unlokc at the Timer end.
like this
-------------
procedure DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw1.CanDraw then exit;
DXDraw1.Surface.Canvas.Lock;
.
.
DXDraw1.Surface.Canvas.UnLock;
end;
-----------------
it's works. Hope this message CAN HELP some guys who got the same problem with me
|
|