Hardware
-
Register Now
or LOG IN to post
- Recent Activity
- FAQs
- Guidelines
Question
-
Creator
Topic
-
Canvas does not drawing
Locked
by
robertln1
·
about 15 years agoAn error message pops-up after I use Excel, Adobe, and real player. Memory is not a problem and I even run the machine with minimum memory use. I am using Windows XP Pro.
Topic is locked
This conversation is currently closed to new comments.
-
Creator
Topic
All Answers
-
Author
Replies
-
-
Clarifications
by
robertln1
·
about 15 years agoIn reply to Canvas does not drawing
Clarifications
-
Exactly what does the error message say?
by
boxfiddler
·
about 15 years agoIn reply to Canvas does not drawing
Windows has a bazillion different error messages that could mean a thousand different things. We need to know what the error message says.
-
Canvas does not allow drawing
by
robertln1
·
about 15 years agoIn reply to Exactly what does the error message say?
The error message reads “Canvas does not allow drawing” at this point you have close every thing and restart the computer. None of the other machines on the network have this problem.
-
I have not ever seen this error before.
by
boxfiddler
·
about 15 years agoIn reply to Canvas does not allow drawing
However, googling the phrase yielded the following, along with a number of other things:
“This is a Windows error caused by low GDI (Graphic Device Interface) resources. This error can occur when too many programs are open or the open programs are using a large amount of Windows resources. The MediSoft Case window is an example of a particularly large user of Windows resources. The MediSoft Case window uses a large amount of resources because of the number of controls (data fields) in the window. This is not a MediSoft deficiency, but a result of the information necessary in the window.”
http://inborne.mykb.com/Article_7A622.aspx
While this information appears to be specific to the app mentioned in it, I think it is highly probable that it is applicable across many situations, being a Windows error.
edit: clarify
-
Now that I know the FULL error message, it is clear…
by
older mycroft
·
about 15 years agoIn reply to Canvas does not allow drawing
That the error is related to whatever strain you are placing on the GUI, related to your system’s graphics (SMA graphics ?) capability.
It seems the most common cause for this error is having multiple windows open simultaneously. usually within a browser.
In your original post you mentioned that memory was not a problem and that you ran the system with minimum memory. I’m interested as to WHY you mentioned that as it’s not the usual thing to put in a post.
Have you had memory problems with this system before ?
How much memory does this ‘puter have ?
Is the graphics memory dedicated or shared ?
When you “[i]close every thing[/i]” how many is that ?
-
-
-
Huh ?…
by
older mycroft
·
about 15 years agoIn reply to Canvas does not drawing
“[i]Canvas does not drawing[/i]” – What does that mean ?
-
-
Author
Replies
TechRepublic Premium
-
TechRepublic PremiumHiring kit: Wireless system engineer
PURPOSE Finding and hiring Wireless System Engineers will require a focused and comprehensive recruitment plan that looks for qualified individuals with the right technical skills and a personality that will best fit your organizational culture. This Hiring Kit from TechRepublic Premium provides an adjustable framework your business can use to find, recruit and ultimately hire …
-
TechRepublic PremiumiCloud Usage Policy
PURPOSE The policy’s purpose is to define proper practices for using Apple iCloud services whenever accessing, connecting to, or otherwise interacting with organization systems, services, data and resources. This policy, from TechRepublic Premium, can be customized as needed to fit the needs of your organization. From the policy: POLICY DETAILS All organization representatives, including all …
-
TechRepublic PremiumIT expense reimbursement policy
PURPOSE The policy’s purpose is to define for employees and authorized representatives the technology-related purchases eligible for reimbursement. The policy also seeks to ensure all expenses are properly reported, processed and reimbursed. This policy, from TechRepublic Premium, can be customized as needed to fit your organization’s needs. From the policy: POLICY DETAILS No technology-related purchases …
-
TechRepublic PremiumInterviewing guidelines policy
PURPOSE This policy from TechRepublic Premium provides guidelines for conducting useful and appropriate interviews with potential new hires, both from a proper methodology perspective and a legal standpoint. These guidelines will help build a reproducible and consistent interview framework that can be applied to any open role. From the policy: INTERVIEWING GUIDELINES The first step …
-
TechRepublic
-
TechRepublic on Twitter
-
TechRepublic on Facebook
-
TechRepublic on LinkedIn
-
TechRepublic on Flipboard
kessor 4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
||||
1 |
||||
15.02.2016, 13:09. Показов 9502. Ответов 6 Метки нет (Все метки)
после N запусков вот этой функции
программа вылетает с ошибкой canvas does not allow drawing
0 |
Пишу на Delphi…иногда 1423 / 1278 / 286 Регистрация: 03.12.2012 Сообщений: 3,914 Записей в блоге: 5 |
|
15.02.2016, 13:25 |
2 |
как исправить? GetWindowDC After painting is complete, the ReleaseDC function must be called to release the device context. Not releasing the window device context has serious effects on painting requested by applications.
0 |
kessor 4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
||||
15.02.2016, 14:06 [ТС] |
3 |
|||
то есть просто добавить строчку
?
0 |
588 / 455 / 147 Регистрация: 09.12.2013 Сообщений: 2,385 Записей в блоге: 2 |
|
15.02.2016, 16:20 |
4 |
Зачем вообще TCanvas? Просто HDC возьмите. И да, освобождать надо.
canvas does not allow drawing Это логически не может быть из-за показанного кода. Вы там ничего не рисуете. В другом месте наверное что-то делается. Добавлено через 22 секунды
0 |
kessor 4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
||||
15.02.2016, 17:27 [ТС] |
5 |
|||
а так можно цвет пикселя получать?
0 |
BOGG ART 588 / 455 / 147 Регистрация: 09.12.2013 Сообщений: 2,385 Записей в блоге: 2 |
||||
15.02.2016, 18:40 |
6 |
|||
Сообщение было отмечено kessor как решение РешениеЯ же говорю — возьмите переменную HDC, освобождайте.
1 |
4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
|
18.02.2016, 17:03 [ТС] |
7 |
после ~100 итераций начинает выдавать всегда одно и то же значение(для G — 255)
0 |
Ошибка — Canvas does not allow drawing |
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|
|
Windows 8.1 |
|
Популярное |
|
Solution 1
If you need to work with an additional canvas you will have to assign a HDC e.g.
var
WindowHandle:HWND;
ScreenCanvas,BufferCanvas: TCanvas;
r,r2: TRect;
ScreenDC,BufferDC :HDC;
BufferBitmap : HBITMAP;
begin
WindowHandle := 0;
ScreenCanvas := TCanvas.Create;
BufferCanvas := TCanvas.Create;
ScreenDC:=GetWindowDC(WindowHandle);
ScreenCanvas.Handle := ScreenDC;
BufferDC := CreateCompatibleDC(ScreenDC);
BufferCanvas.Handle := BufferDC;
BufferBitmap := CreateCompatibleBitmap(ScreenDC,
GetDeviceCaps(ScreenDC, HORZRES),
GetDeviceCaps(ScreenDC, VERTRES));
SelectObject(BufferDC, BufferBitmap);
try
r := Rect(0, 0, 200, 200);
BufferCanvas.CopyRect(r,ScreenCanvas,r);
form1.Canvas.CopyRect(r, BufferCanvas, r);
finally
ReleaseDC(WindowHandle, ScreenCanvas.Handle);
DeleteDC(BufferDC);
DeleteObject(BufferBitmap);
BufferCanvas.Free;
ScreenCanvas.Free;
end;
end;
Solution 2
It’s a time to toss my solution into the pot!
procedure TForm1.FormClick(Sender: TObject);
var
ScreenCanvas: TCanvas;
begin
ScreenCanvas := TCanvas.Create;
try
ScreenCanvas.Handle := GetWindowDC(GetDesktopWindow);
Win32Check(ScreenCanvas.HandleAllocated);
Canvas.CopyRect(Canvas.ClipRect, ScreenCanvas, ScreenCanvas.ClipRect);
finally
ReleaseDC(GetDesktopWindow, ScreenCanvas.Handle);
ScreenCanvas.Free;
end;
end;
Comments
-
I want to Draw a Screenshot from the entire screen to a TForm1 Canvas.
This code works well in Delphi XE3
procedure TForm1.Button1Click(Sender: TObject); var c,scr: TCanvas; r,r2: TRect; begin c := TCanvas.Create; scr := TCanvas.Create; c.Handle := GetWindowDC(GetDesktopWindow); try r := Rect(0, 0, 200, 200); form1.Canvas.CopyRect(r, c, r); finally ReleaseDC(0, c.Handle); c.Free; end;
Now I want to copy the screenshot to another canvas first.
Is there a way to do this without getting this error?procedure TForm1.Button1Click(Sender: TObject); var c,scr: TCanvas; r,r2: TRect; begin c := TCanvas.Create; scr := TCanvas.Create; c.Handle := GetWindowDC(GetDesktopWindow); try r := Rect(0, 0, 200, 200); scr.CopyRect(r,c,r); <-- Error, canvas does not allow drawing form1.Canvas.CopyRect(r, scr, r); <-- Error, canvas does not allow drawing finally ReleaseDC(0, c.Handle); c.Free; end;
-
Once you do that,
scr
is rather pointless. You may as well just draw directly tobmp.Canvas
. -
@RobKennedy I know it was an example, could have been another DC too.
-
This is very tangled and intricate example: you don’t that excess canvas at all, it is actually a unobvious clone of bmp’s MemDC.
Recents
Related
Home› General
Windows service and ‘canvas does not allow drawing’ error
I have a windows service which produces PDF files using report
builder 14.04. One of our clients had an error today ‘canvas does not
allow drawing’.
reading back through some very old posts I came up with a couple of
bits of advice.
1.) There needs to be a default printer installed. RB requires this
despite not actually printing to the printer concerned. In this case
there was a default printer but it was a network printer which was
unreachable. I installed a random print driver on lpt1 and the error
went away.
2.) set the printer name to ‘Screen’. This would be the preferred
solution but did not work in this case. Would the windows service need
to be given permission to interact with the desktop for this to work?
Is there anything else I am unaware of when it comes to resolving this
error. Ideally I would like to not have to create a dummy printer on
every server I work with. In some cases this may not be possible anyway.
Regards,
Will.
В чем вопрос-то? Куда нажать, чтобы увидеть? На свежей альфе? Знаете-ка что…. Этой ошибке ТРИСТА ЛЕТ! Посмотрите на дату исходного сообщения — март 2006 года.
Никуда не нажать. Эта ошибка возникает сама по себе и непредсказуемо. И чем дальше бат деградирует (с увеличением номера версии) — тем чаще.
Я ж сказал — на форумах по дельфи про такую проблему знают, знают про ее причины и знают, что надо делать, чтобы она не возникала. И всяких новичков терпеливо учат, как надо программировать многопоточные приложения.
Также, когда я искал информацию об этой ошибке, я видел много релизов РАЗНЫХ программ, в описании к которым было указано, что в этой версии «исправлена ошибка, приводящая к Canvas does not allow drawing и к Acsess violation at address».
Отрицать очевидное бессмысленно — ошибка в Бате есть, и причина ее — корявое программирование, рассинхронизация процессов, утечки памяти.
Беда в том, что эту ошибку в Бате уже НИКОГДА не исправить!!! Слишком все запущено. Я представляю, сколько кода надо перелопатить. А код уже давно такой, что в одном месте тронешь — в трех других сразу рассыпается.