Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to change a form's caption font and alignment (2) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Oct-02
Category
VCL-Forms
Language
Delphi 5.x
Views
96
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Does anyone know how to write text with the TEXTOUT command in the title bar of a 
form in D5?

Answer:

You have to handle the WM_NCPAINT message.

1   { ... }
2   type
3     TForm1 = class(TForm)
4     private
5       procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
6     public
7     end;
8   
9   var
10    Form1: TForm1;
11  
12  implementation
13  
14  {$R *.dfm}
15  
16  procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
17  var
18    ACanvas: TCanvas;
19  begin
20    inherited;
21    ACanvas := TCanvas.Create;
22    try
23      ACanvas.Handle := GetWindowDC(Form1.Handle);
24      with ACanvas do
25      begin
26        Brush.Color := clActiveCaption;
27        Font.Name := 'Tahoma';
28        Font.Size := 8;
29        Font.Color := clred;
30        Font.Style := [fsItalic, fsBold];
31        TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),
32          Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height)) / 2) + 1,
33            ' Some Text');
34      end;
35    finally
36      ReleaseDC(Form1.Handle, ACanvas.Handle);
37      ACanvas.Free;
38    end;
39  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC