Article View: borland.public.cppbuilder.nativeapi
Article #4797Re: Capture WM_NCPAINT?
From: Remy Lebeau (TeamB)
Date: Wed, 23 Nov 2005 09:58
Date: Wed, 23 Nov 2005 09:58
55 lines
2447 bytes
2447 bytes
"Paw Suddergaard" <paw@top-house.dk> wrote in message
news:43843bb9$1@newsgroups.borland.com...
> BTW: Heres a delphi example of somwthing like that. I just need it in
C++...
>
> http://www.scalabium.com/faq/dct0059.htm
class TForm1 : public TForm
{
private:
MESSAGE void __fastcall WMNCPaint(TWMNCPaint &Message);
//...
public:
//...
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_NCPAINT, TWMNCPaint, WMNCPaint)
END_MESSAGE_MAP(TForm)
};
void __fastcall TForm1::WMNCPaint(TWMNCPaint &Message)
{
TForm::Dispatch(&Message);
TCanvas *ACanvas = new TCanvas;
try
{
// to retrieve the device context for the window
ACanvas->Handle = GetWindowDC(Handle);
ACanvas->Brush->Color = clActiveCaption;
ACanvas->Font->Style = TFontStyles() << fsItalic;
// 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) + 1;
// output the caption string
ACanvas->TextOut(intLeftShift, intTopShift, Caption);
}
__finally
{
// to release the device context
ReleaseDC(Handle, ACanvas->Handle);
delete ACanvas;
}
}
Gambit
Technical Details
Message-ID:
<43843d59$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43843bb9$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 From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <43843bb9$1@newsgroups.borland.com> Subject: Re: Capture WM_NCPAINT? Date: Wed, 23 Nov 2005 01:58:06 -0800 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <43843d59$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1132739929 68.69.17.41 (23 Nov 2005 01:58:49 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail