🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Capture WM_NCPAINT?

#4760
From: Paw Suddergaard
Date: Tue, 29 Nov 2005 09:45
58 lines
3208 bytes
> That can't be all of it because you said that you were changing
> the color to clRed. Nowhere in your code are you doing that.
> In fact, you're not setting the color anywhere in there. Try
> adding code that explicitly sets the newly allocated TCanvas's
> Font and Font::Color.

Oh i was "simplyfying" my code...

ACanvas->Font->Color = clRed;

^^ Was the line that set the font color...


>>      ACanvas->Brush->Style = bsClear;//transparant background
> 
> 
> I'm not sure that that's the right thing to do. However, I do
> know that this works:
> 
>     int pMode = ::SetBkMode( ACanvas->Handle, TRANSPARENT );
>     //...
>     ::SetBkMode( ACanvas->Handle, pMode );

^^ That works to, just as setting brush style... But i still have the 
problem heres the code now:

void __fastcall TForm2::WMNCPaint(TWMNCPaint &Message)
{
   TForm::Dispatch(&Message);
   TCanvas *ACanvas = new TCanvas;
   try
   {
       // to retrieve the device context for the window
       ACanvas->Handle = GetWindowDC(Handle);
       int pMode = ::SetBkMode( ACanvas->Handle, TRANSPARENT );
       //ACanvas->Brush->Style = bsClear;
       ACanvas->Font->Style = TFontStyles() << fsBold;
       ACanvas->Font->Color = clRed;
       // calculate the left coordinate for caption drawing
       int intLeftShift = GetSystemMetrics(SM_CYMENU) + 
GetSystemMetrics(SM_CXBORDER);

       // calculate the top coordinate for caption drawing
       int intTopShift = ((GetSystemMetrics(SM_CYCAPTION) - 
abs(ACanvas->Font->Height)) / 2);

       // output the caption string
       ACanvas->TextOut(intLeftShift, intTopShift, "Test!");
       ::SetBkMode( ACanvas->Handle, pMode );
   }
   __finally
   {
       // to release the device context
       ReleaseDC(Handle, ACanvas->Handle);
       delete ACanvas;
   }
}
//---------------------------------------------------------------------------
Technical Details
Message-ID: <438c209c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43843bb9$1@newsgroups.borland.com> <43843d59$1@newsgroups.borland.com> <438b21c8$1@newsgroups.borland.com> <438b89a3$1@newsgroups.borland.com> <438c0d22$1@newsgroups.borland.com> <438c1578$1@newsgroups.borland.com> <438c19b9$1@newsgroups.borland.com> <438c1ec8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,95cf0255de9936de
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 29 Nov 2005 10:45:39 +0100
From: Paw Suddergaard <paw@top-house.dk>
User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Capture WM_NCPAINT?
References: <43843bb9$1@newsgroups.borland.com> <43843d59$1@newsgroups.borland.com> <438b21c8$1@newsgroups.borland.com> <438b89a3$1@newsgroups.borland.com> <438c0d22$1@newsgroups.borland.com> <438c1578$1@newsgroups.borland.com> <438c19b9$1@newsgroups.borland.com> <438c1ec8$1@newsgroups.borland.com>
In-Reply-To: <438c1ec8$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 62.242.10.213
Message-ID: <438c209c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1133256860 62.242.10.213 (29 Nov 2005 01:34:20 -0700)
Lines: 58
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail