Solved

How can I set the TCustomForm.clientheight to 768?

Posted on 1998-12-17
5
172 Views
Last Modified: 2010-04-04
How can I set the TCustomForm.clientheight to 768?

I have and application that I want to cover the full screen, with no border. This means that I set the Borderstyle := bsNone;
BorderIcons := [];

Since I work in 1024*768 resolution I set:
ClientWidth := 1028;

But then when I set ClientHeight to 768 it jumps back to 753 leaving Height at 780. I have tried this with both WindowState = wsNormal and WindowState = wsMaximized. This leaves an application that almost, but not quite, covers the screen. Why is this happening? Is there a way around it?

Bra
0
Comment
Question by:bra033098
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1351527
hi bra,

it seems the problem is only in designmode, because in designmode is always the windowstitle present and there will be a formula like maxclientheight := screenheight-windowstitleheight.

but you can set it at runtime

procedure TForm1.FormCreate(Sender: TObject);
begin
  form1.Top := 0;
  form1.left := 0;
  form1.clientwidth := 1024;
  form1.clientheight :=768;
end;

meikl
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1351528
You should also try different border styles. The sizing behaves different with different border styles...

Regards... Madshi.
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1351529
At design time, why not say:
BorderStyle = bsNone
BorderWidth = 0
WindowState = wsMaximized

Run the program, it covers the full screen and client height is 768 (at least it is on my machine)

With a menu bar, client height is less, but the window still covers the entire screen.

Note that setting the clientheight to 768 is maybe not the best idea. If someone runs your app on a higher resolution, it'll only cover the top left area of the screen. On a lower resolution, a status bar (if you have one) would not be visible. If you really want to set the clientheight, then use Screen.Height instead of 768.

0
 

Author Comment

by:bra033098
ID: 1351530
Meikl

Tried it, it works, thanks. Bit inconsistent?


philipleighs

Thanks for the tip on using Screen.Height instead. The application I am writing will always
be on the same type of machine and it is therefore not a worry, but do we ever know what the
future holds? (Ask Bill Gates about 640k)

bra
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 1351531
hi bra,

will you give me the points then accept,
otherwise reject.

meikl
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

23 Experts available now in Live!

Get 1:1 Help Now