| 
			Author: Jonas Bilinkevicius
How to paint formatted text on the title bar of a TForm
Answer:
This source code allows you to write text everywhere on the form and also on the 
title bar. You can even rotate the text at a certain angle. Just keep in mind, that 
the code below only works with Truetype fonts.
1   { ... }
2   private
3   {Private declarations}
4   
5   procedure Check(var aMsg: TMessage); message WM_ACTIVATE;
6   public
7     {Public declarations}
8   end;
9   
10  var
11    Form1: TForm1;
12  
13  implementation
14  
15  {$R *.DFM}
16  
17  procedure MyTextOut(form: TForm; txt: string; x, y, angle, fontsize: Integer;
18    fontcolor: TColor;
19    fontname: PChar; italic, underline: Boolean);
20  var
21    H: HDC;
22    l, myfont: Integer;
23  begin
24    l := length(txt);
25    H := GetWindowDC(Form.handle);
26    SetTextColor(H, fontcolor);
27    SetBkMode(H, Transparent);
28    Myfont := CreateFont(fontsize, 0, angle * 10, 0, FW_SEMIBOLD, ord(italic),
29      ord(underline), 0,
30      DEFAULT_CHARSET, OUT_TT_PRECIS, $10, 2, 4, fontname);
31    SelectObject(H, myfont);
32    TextOut(H, x, y, pchar(txt), l);
33    DeleteObject(myfont);
34    ReleaseDC(Form.handle, H);
35  end;
36  
37  {Paint text on title bar}
38  
39  procedure TForm1.FormCreate(Sender: TObject);
40  begin
41    Form1.Caption := '';
42  end;
43  
44  procedure DrawText;
45  begin
46    MyTextout(Form1, 'This is italic', 30, 25, 0, 15, clYellow, 'Arial', true, false);
47    MyTextout(Form1, 'This is underline', 125, 5, 0, 15, clYellow, 'Arial', false,
48      true);
49  end;
50  
51  procedure TForm1.Check(var aMsg: TMessage);
52  begin
53    DrawText;
54  end;
55  
56  procedure TForm1.FormPaint(Sender: TObject);
57  begin
58    DrawText;
59  end;
			 |