🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17126

Problem with Thread and OnPaint

#17126
From: Phuoc Can HUA
Date: Mon, 07 Apr 2003 00:10
25 lines
2093 bytes
I'm using a Canvas (WorkSpace) where I do my drawing and a PaintBox to
display the results. A Thread is used to draw on WorkSpace and copy the
modified segment into PaintBox. Another procedure, triggered by OnPaint
event, copies the entire WorkSpace into the PaintBox to restore the image.
Semaphore is used to ensure that the restore procedure will not copy an
unfinished image. Canvas are locked while they are in use.

Now, when I move the main form over the form with the PaintBox very fast the
image can't be restored properly. It looks like Windows can detect the
'invalid' area and only updates a small part of the PaintBox, although my
procedure copies the entire image. That's OK. But the 'funny' thing is that
the update segment sometimes appears at the wrong place, somtimes even
somewhere on the screen (outside of the paintbox). Of course, sometimes it
crashes as well :-(

The program was working fine without Thread. Can anyone help?

Thanks
Phuoc


--
_/\__/\__/\__/\__/\__/\_
www.huaonline.com
My Homepage is my Castle
Technical Details
Message-ID: <3e90c1f3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news1.optus.net.au!optus!ken-transit.news.telstra.net!news.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f582f476470f4983,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-06 17:12:43 PST
From: "Phuoc Can HUA" <home+a+t+huaonline.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Problem with Thread and OnPaint
Date: Mon, 7 Apr 2003 10:10:42 +1000
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 210.9.89.210
Message-ID: <3e90c1f3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049674227 210.9.89.210 (6 Apr 2003 17:10:27 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news1.optus.net.au!optus!ken-transit.news.telstra.net!news.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail