🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

redrawing text and transparency

#5693
From: Maileen
Date: Sun, 17 Jul 2005 16:58
43 lines
2368 bytes
Hi,

I wrote my own Splash class and in this class, i have a place for 
displaying messages at the bottom on my window.

To display messages, i've created a static text window, thanks to 
CreateWindowEx.
I've overloaded my WndProc with my own window procedure but i still have 
some problem to make my text with transparent background.

I suppose 2 ways exists :
- creating a brush of my text window area and using it before to write 
new text message
- to make my text tranparent using setBkMode

here is my code from my WndProc:
...
case WM_PAINT :
                                          HDC hdc;  // declare a handle 
to the device context
  hdc = GetDC(hWnd);      // hWnd is the handle of my Text box created 
with CreateWindowEx
  SetBkMode(hdc, TRANSPARENT);      // set transparency
  SetTextColor(hdc, RGB(0,0,0));
  TextOut(hdc, 0, 0,MyMessage, strlen(MyMessage));
  ReleaseDC(hWnd, hdc);

case WM_ERASEBKGND :
  return true;
...

unfortunately, when i display my first message, everything is ok, but 
problem happens after (during displaying of my second message)...
it's written on the first one, so it becomes unreadable...
I tried to make my first message disappears but except to create brush 
from initial state of my hWnd, i don't see how to solve this issue.

Moreover, i have some problem to create a brush from rectangle of my 
textbox and to use it after.

Could someone help me to solve my transparent problem ?
thanks a lot,
Maileen
Technical Details
Message-ID: <42da8e32$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,87ada6026d3523c5,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 17 Jul 2005 18:58:17 +0200
From: Maileen <nospam@noemail.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: redrawing text and transparency
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 195.98.3.139
Message-ID: <42da8e32$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1121619506 195.98.3.139 (17 Jul 2005 09:58:26 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail