Hi, whenever I try to use my application on a client’s computer I get the error message «Canvas Does not Allow Drawing.» This happens only when I try to print a Report using fastreport 3. I use InstallShield and have included all fastreport libraries.
Any suggestions would be greatly appreciated.
Comments
-
Hi, whenever I try to use my application on a client’s computer I get the error message «Canvas Does not Allow Drawing.» This happens only when I try to print a Report using fastreport 3. I use InstallShield and have included all fastreport libraries.
Any suggestions would be greatly appreciated.
I know this is VERY old post, but thought I would just advise as it is the only valid page on the subject when doing a search on Google. It seems that your c: drive needs to have a temp folder, in order for the canvas to be drawn, there must be read&write permissions on the folder too.
-
Hi, whenever I try to use my application on a client’s computer I get the error message «Canvas Does not Allow Drawing.» This happens only when I try to print a Report using fastreport 3. I use InstallShield and have included all fastreport libraries.
Any suggestions would be greatly appreciated.
I know this is VERY old post, but thought I would just advise as it is the only valid page on the subject when doing a search on Google. It seems that your c: drive needs to have a temp folder, in order for the canvas to be drawn, there must be read&write permissions on the folder too.
This is VERY old post, but still actual. It is important to have some default printer on your system — but NOT Fax!
-
This is a very old post but have helped me lot.
The only thing I needed to do was to run RAD Studio XE2 as Administrator.
All fixed!Thank you
-
this post is helping confused computer users since 2006!
long live the post ! -
The post is not dead! Long live the post!
Leave a Comment
kessor 4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
||||
1 |
||||
15.02.2016, 13:09. Показов 9019. Ответов 6 Метки нет (Все метки)
после N запусков вот этой функции
программа вылетает с ошибкой canvas does not allow drawing
__________________
0 |
Пишу на Delphi…иногда 1422 / 1277 / 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 |
587 / 454 / 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 587 / 454 / 147 Регистрация: 09.12.2013 Сообщений: 2,385 Записей в блоге: 2 |
||||
15.02.2016, 18:40 |
6 |
|||
РешениеЯ же говорю — возьмите переменную HDC, освобождайте.
1 |
4 / 4 / 2 Регистрация: 27.10.2014 Сообщений: 90 |
|
18.02.2016, 17:03 [ТС] |
7 |
после ~100 итераций начинает выдавать всегда одно и то же значение(для G — 255)
0 |
|
|
Здравствуйте! void __fastcall TFMain::AppException(TObject *Sender, Exception *E) { Screen->Cursor = crDefault; if (onSxfLoad) { sprintf(buf, «Файл %srnОшибка на объекте %d:%d:», OpenDialog1->FileName, sxfItem->api->MapObj->code, sxfItem->api->MapObj->num); switch (sxfItem->api->MapObj->local) { case 0 : strcat(buf, «LIN»); break; case 1 : strcat(buf, «SQR»); break; case 2 : strcat(buf, «DOT»); break; case 3 : strcat(buf, «TXT»); break; case 4 : strcat(buf, «VEC»); break; case 5 : strcat(buf, «MIX»); break; default : strcat(buf, «UFO»); break; } strcat(buf, «rn»); strcat(buf, E->Message.c_str()); Application->MessageBox(buf, «Ошибка чтения файла», MB_ICONWARNING); } else { ShowMessage(E->Message.c_str()); // вот сюда попадаю Application->Terminate(); } } Рухает после загрузки примерно 20 карт в OnPaint пейнтбокса, на который выводится БМП: void __fastcall TFMain::PBPaint(TObject *Sender) { PB->Canvas->Draw(0, 0, bmp); } Куда рыть? Проверить, всем ли SelectObject() есть соответствующие DeleteObject()? Или тут что-то другое? |
popsa |
|
поток я так понимаю у тебя один, поэтому скорее всего что то из этого Цитата Question: Сообщение отредактировано: popsa — 22.10.10, 12:43 |
leo |
|
Цитата #SI# @ 22.10.10, 12:15 Проверить, всем ли SelectObject() есть соответствующие DeleteObject()?
Интересно, а зачем вообще их понадобилось юзать. Чем VCL-ные обертки не устраивают, или хочется создать «гремучую смесь» VCL и API ?! |
#SI# |
|
leo, научи, как висюльками нарисовать PolyPolygon() и выполнить TransparentBlt(). Ну шо те стоит, а? Сообщение отредактировано: #SI# — 22.10.10, 17:54 |
leo |
|
Цитата #SI# @ 22.10.10, 17:48 Да, и заодно как такое пёрышко создать?
Не понятно, чем ты вообще занимаешься — хочешь слепить свою самоделку лучше или дешевле, чем Панорама ГИС-вьюер ?! |
#SI# |
|
leo, ты по делу можешь ответить? Если нет — то не парься, ага? А с поделками этой конторы я знаком не понаслышке… switch (obj->code) { //….. case 71323000 : pen = ::CreatePen(PS_SOLID, 1, clBlack); logBrush.lbStyle = BS_HATCHED; logBrush.lbColor = clBlack; logBrush.lbHatch = HS_CROSS; brush = ::CreateBrushIndirect(&logBrush); DrawPolygon(hdc, points, pointCount, metricCount, pen, brush); return; //———————————————————————— case 71610000 : pen = ::CreatePen(PS_DASH, 1, clBlack); brush = ::CreateSolidBrush(clWhite); DrawPolygon(hdc, points, pointCount, metricCount, pen, brush); return; //======================================================================= default : // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! pen = ::CreatePen(PS_SOLID, 1, clFuchsia); brush = ::CreateSolidBrush(clFuchsia); DrawPolygon(hdc, points, pointCount, metricCount, pen, brush); return; } } А вот вывод полигона: void DrawPolygon(HDC dc, TPoint *pnts, int *pCount, int mCount, HPEN pen, HBRUSH brush) { HPEN dcPen = ::SelectObject(dc, pen); HBRUSH dcBrush = ::SelectObject(dc, brush); ::PolyPolygon(dc, pnts, pCount, mCount); ::SelectObject(dc, dcPen); ::DeleteObject(pen); ::SelectObject(dc, dcBrush); ::DeleteObject(brush); } Причем когда искусственно устанавливаю коды в 0 и вывожу по дефолту — проблем нет! Такое впечатление, что глюк идёт из-за вызовов CreateBrushIndirect() default : pen = ::CreatePen(PS_SOLID, 1, clFuchsia); // brush = ::CreateSolidBrush(clFuchsia); logBrush.lbStyle = BS_HATCHED; logBrush.lbColor = clBlack; logBrush.lbHatch = HS_CROSS; brush = ::CreateBrushIndirect(&logBrush); DrawPolygon(hdc, points, pointCount, metricCount, pen, brush); return; Всё ОК… Пошёл рыцца дальше… // плотнозастроенные case 1 : value = GetAtrValue(atrs, 243); switch (value) { // крупный город case 20 : brush = ::CreateSolidBrush(RGB(255, 148, 40)); // жёлтенькие break; // малый город, ПГТ case 21 : case 22 : brush = ::CreateSolidBrush(LTGRAY_BRUSH); break; // с/х и дачные посёлки case 23 : case 24 : brush = ::CreateSolidBrush(BLACK_BRUSH); break; // прочие НП case 26 : brush = ::CreateSolidBrush(BLACK_BRUSH); break; // любые НП /* а кисти — нет */ case 28 : ::CreateSolidBrush(RGB(255, 148, 40)); // жёлтенькие break; /* -*- */ default : ::CreateSolidBrush(RGB(255, 0, 0)); // UFO } break;
Всем спасибо за внимание! Сообщение отредактировано: #SI# — 23.10.10, 16:11 |
leo |
|
Цитата #SI# @ 23.10.10, 11:11 Лео, ежели кинет тебя судьба и заставит писать на Панорамных MapAPI / GTK — спрашивай, не стесняйся. Чем смогу — помогу!
|
#SI# |
|
Цитата leo @ 24.10.10, 07:45 а я им «с высоты птичьего полета» Штаны не потеряй. Давай ты будешь своим делом заниматься, а я — своим. И помогать друг другу. А по части флудежа в тематике тебе всё равно за мной не угнацца. Не веришь — спроси тутошних модераторов. Они много чего могут вспомнить Добавлено 24.10.10, 09:17 |
leo |
|
Цитата #SI# @ 24.10.10, 09:13 Давай ты будешь своим делом заниматься
Я своим и занимаюсь — пытаюсь обратить внимание на то, что, возможно, вы НЕ «верной дорогой идете, товарисч!» |
#SI# |
|
Да простят меня модеры за забивание форума картинками… Мил человек, не рассказывай мне, как делаются ГИСы. Я этим занимался ещё тогда, когда ты штаны мочил… Ничего личного. Ага. Не надо считать собеседников дебилами.
— Добавлено 25.10.10, 10:18 Вопрос к МАСТЕРАМ уровня Адиля/Тренера (в алфавитном порядке Сообщение отредактировано: #SI# — 25.10.10, 10:20 |
Hardware
-
Register Now
or LOG IN to post
- Recent Activity
- FAQs
- Guidelines
Question
-
Creator
Topic
-
Canvas does not drawing
Locked
by
robertln1
·
about 14 years, 10 months 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.
-
Creator
Topic
All Answers
-
Author
Replies
-
-
March 21, 2008 at 11:28 pm
#2547674
Clarifications
by
robertln1
·
about 14 years, 10 months agoIn reply to Canvas does not drawing
Clarifications
-
March 21, 2008 at 11:31 pm
#2547672
Exactly what does the error message say?
by
boxfiddler
·
about 14 years, 10 months 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.
-
March 22, 2008 at 6:20 pm
#2573660
Canvas does not allow drawing
by
robertln1
·
about 14 years, 10 months 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.
-
March 22, 2008 at 6:54 pm
#2573647
I have not ever seen this error before.
by
boxfiddler
·
about 14 years, 10 months 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
-
March 22, 2008 at 7:45 pm
#2573632
Now that I know the FULL error message, it is clear…
by
older mycroft
·
about 14 years, 10 months 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 ?
-
-
-
March 21, 2008 at 11:32 pm
#2547671
Huh ?…
by
older mycroft
·
about 14 years, 10 months agoIn reply to Canvas does not drawing
“[i]Canvas does not drawing[/i]” – What does that mean ?
-
-
Author
Replies