Solved

FORM CAPTION

Posted on 2003-10-22
5
149 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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