Solved

FORM CAPTION

Posted on 2003-10-22
5
151 Views
Last Modified: 2010-07-27
How to change form cation size (height) & set picture ?

Thanks.
0
Comment
Question by:vbmn
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 9598687
Not...
What most people do is use a form without a caption and draw their own caption inside it. It is possible to draw inside the caption, though, by capturing the WM_NCPAINT message aand drawing on the window provided by this message. There are several other WM_NCxxx messages available that can be useful. But changing the height? Not possible.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 9598958
Why not possible to change the height?

Look the following:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
  private
     procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
  end;

var Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
var ACanvas: TCanvas;
    intLeftShift, intTopShift: Integer;
begin
  inherited;
  Form1.caption := '';
  ACanvas := TCanvas.Create;
  try
    ACanvas.Handle := GetWindowDC(Form1.Handle);
    with ACanvas do
    begin
      Brush.Style := bsclear;
      Font.Style := [fsItalic, fsBold];
      font.Height := 20;
      intLeftShift := GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER);
      intTopShift := (GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height)) div 2 + 2;
      TextOut(intLeftShift, intTopShift, 'Caption here')
    end;
  finally
    ReleaseDC(Form1.Handle, ACanvas.Handle);
    ACanvas.Free
  end;
end;
end.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 9605231
I was wondering if my comment gave you any help...
If so maybe it should have some points too...
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9615977
I have no problem sharing the points if your solution works. Does it?
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 9617875
Yes it does, but don't worry......
It's right so.....
F68 :-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question