Solved

FORM CAPTION

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now