Message-ID: <3B7C8B3A.A2FEF0E2@borland.newsgroups> Date: Fri, 17 Aug 2001 13:10:50 +1000 From: Charles Hacker X-Mailer: Mozilla 4.77 [en] (Win95; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: borland.public.delphi.graphics Subject: Re: PaintTo, WM_NCPAINT etc... References: <3b7c3156_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 132.234.46.2 X-Trace: dnews 998017859 132.234.46.2 (16 Aug 2001 20:10:59 -0700) Lines: 57 Path: dnews Xref: dnews borland.public.delphi.graphics:41306 Azret Botash wrote: > > Hi, > This issue has been discussed probably but I cannot find the answer in the > archives. > Basicly what I need is a PaintTo that can paint the non-client area as well. > BitBlt and the family won't work cause the window is actually hidden and not > all controls implement the WM_PRINT. > An example follows: type TForm1 = class(TForm) private procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT; public end; var Form1 : TForm1; implementation {$r *.dfm} procedure TForm1.WMNCPaint(var Msg: TWMNCPaint); var ACanvas : TCanvas; begin inherited; ACanvas := TCanvas.Create; try ACanvas.Handle := GetWindowDC(Form1.Handle); with ACanvas do begin Brush.Color := clActiveCaption; Font.Name := 'Tahoma'; Font.Size := 8; Font.Color := clred; Font.Style := [fsItalic, fsBold]; TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER), Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height))/2) +1, ' Some Text' end; finally ReleaseDC(Form1.Handle, ACanvas.Handle); ACanvas.Free; end; end; -- Charles Hacker Lecturer in Electronics and Computing School of Engineering Griffith University - Gold Coast Australia