🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: redrawing text and transparency

#5694
From: Ed Mulroy
Date: Sun, 17 Jul 2005 19:47
61 lines
3445 bytes
When posting code please take time to check what is being posted.  The
behavior of the code you show is not what you describe.  It does not paint
the background.  It does not show a splash image.  All it does is write some
text on the background.

The common technique for doing a splash screen is to use BitBlt to paint an
image that fills the client area.  If text is to be written and then
replaced with other text the original text must first be removed.  The
function TextOut has no facilities for removing it.

A common technique to do what you wish is to create a memory bitmap and
memory device context, do your assembly of the image with text on it and
then BitBlt it to the window.  The next time WM_PAINT is received it will 
assemble an image with the current or new text value, depending upon what 
you coded it to do.

.  Ed

> Maileen wrote in message
> news:42da8e32$1@newsgroups.borland.com...
>
> 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,
Technical Details
Message-ID: <42dab5e0@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.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42da8e32$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,87ada6026d3523c5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42da8e32$1@newsgroups.borland.com>
Subject: Re: redrawing text and transparency
Date: Sun, 17 Jul 2005 15:47:39 -0400
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 4.239.183.245
Message-ID: <42dab5e0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1121629664 4.239.183.245 (17 Jul 2005 12:47:44 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail