🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with Thread and OnPaint

#17152
From: Remy Lebeau (TeamB)
Date: Mon, 07 Apr 2003 17:35
38 lines
2466 bytes
"Phuoc Can HUA" <home+a+t+huaonline.com> wrote in message
news:3e9107d2$1@newsgroups.borland.com...

> Haven't got all what you mean. Do you mean... the thread only
> draws on a bitmap (Canvas?)

Not a Canvas, no.  Well, yes, but not a standalone TCanvas, but an actual
TBitmap instead.  Or, since you're posting this in the .nativepapi group, a
call to CreatecomatibleDC(), CreateCompatibleBitmap(), SelectObject(), and
any drawing functions you're using.

> without copying the results to the PaintBox.

Not from the thread itself, no.

> But how can I display the results?

Put the bitmap where the PaintBox can get to it, and then it's OnPaint event
goes and grabs the current bitmap when needed.

> Do I have to trigger OnPaint to refresh the image?

Not directly, no.  However, your thread could Invalidate() the PaintBox
after rendering the bitmap.  Invalidate() wil force the PaintBox to redraw
itself when it is actually ready to do so, which will then trigger OnPaint
indirectly.

> Currently, my OnPaint seems to be running 'wild'. As I mentioned,
> sometimes it just draws on the screen across several windows.

I can't comment on that as you never posted your actual source code.  But
that sounds like a symptom of logic errors in your own code, or you're at
least not clipping the image first before drawing it so it doesn't go out of
the boundaries of the area of the PaintBox ou want to draw in only.


Gambit
Technical Details
Message-ID: <3e91b72c$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e90c1f3$1@newsgroups.borland.com> <3e90fe9b$1@newsgroups.borland.com> <3e9107d2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f582f476470f4983
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-07 10:42:20 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e90c1f3$1@newsgroups.borland.com> <3e90fe9b$1@newsgroups.borland.com> <3e9107d2$1@newsgroups.borland.com>
Subject: Re: Problem with Thread and OnPaint
Date: Mon, 7 Apr 2003 10:35:49 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e91b72c$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049737004 207.175.226.26 (7 Apr 2003 10:36:44 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail