?
Solved

canvas error

Posted on 2001-09-11
6
Medium Priority
?
347 Views
Last Modified: 2010-04-06
i've got a difficulty to detect an error "canvas doesn't allow drawing". can anybody help me why this error message appear? thanks.
0
Comment
Question by:el_shiro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6473617
from http://www.delphifaq.com/fq/q4053.shtml


Msg 'Canvas does not allow drawing'
Q:
What does the error message 'Canvas does not allow drawing' mean?

A:
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.
0
 

Expert Comment

by:rrivas
ID: 6475237
Maybe you don't have disk space or memory space or you have processes hangs up. Try to see you disk space.

Regards

RRivas
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6476578
Hi el_shiro,

try use this construction, sometimes it helps.

  if HandleAllocated then
  begin
    // perform drawing here
  end;

-----
Igor.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:cubud
ID: 6476639
Does the canvas belong to a TWinControl descendent or a TGraphicControl descendent ?

If TGraphicControl then you can only draw on the canvas during its OnPaint event.  In this case put your code in OnPaint and when you want to do the drawing do

MyControl.Invalidate;

Pete
http://www.HowToDoThings.com (Delphi articles)
http://www.Stuckindoors.com/delphi (Open source)
0
 
LVL 6

Expert Comment

by:edey
ID: 6494426
You may also get this if you're trying to draw to/use a HDC that isn't valid (yet) or if you attempt to treat a HWND like a HDC.  I'd go & check your code to make sure that you don't draw to or refrence any canvas of canvas handle in your cnostructors, or any other place untill your sure that all the initialization has been done.

GL
Mike
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8280646
All,
I am unlocking this question in preparation for cleanup.  I will return in 7 days to finalize this question.  Please leave any recommendations for the final state of this question, I will take all recommendations into consideration.  Failing any feedback, I may decide in 7 days to delete or PAQ this question with no refund.  Thanks.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question