Solved

Desktop boundaries

Posted on 2001-07-19
3
169 Views
Last Modified: 2010-04-06
Howdy guys!

I need to position my form at the bottom right corner of the screen. I got that working through:

  Top := Screen.Height-Height-Y;
  Left := Screen.Width-Width-X;

But when I have for example ICQ at the right-hand corner, "attached" to the edge of the screen, my form is still in the same position, but blocked behind the ICQ window. Thus I'll need the coordinates of the desktop area.

Or if anyone has any other idea of something that would fix this, I'd be happy if you'd share it. =)


Have a nice day! :o)

Johan
0
Comment
Question by:sageryd
3 Comments
 

Expert Comment

by:Richard_Yu
Comment Utility
In my program I set my main form's position by add the following code in FormCreate:

Self.Top := Screen.Height - 28 - Self.Height;//28 is the height of Windows task bar
Self.Left := Screen.Width - Self.Width;

It work's fine so I think it maybe useful for you.
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 20 total points
Comment Utility
Try this:

var rect: TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
  Label1.Caption := IntToStr(rect.Left);
  Label2.Caption := IntToStr(rect.Top);
  Label3.Caption := IntToStr(rect.Right);
  Label4.Caption := IntToStr(rect.Bottom);
end;
0
 
LVL 1

Author Comment

by:sageryd
Comment Utility
Thanx! Works excellent.

var Rect: TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
  Top := Rect.Bottom-Height-5;
  Left := Rect.Right-Width-5;
end;


Richard, the height of the taskbar can vary.
0

Featured Post

Free Trending Threat Insights Every Day

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This video discusses moving either the default database or any database to a new volume.
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.

771 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

15 Experts available now in Live!

Get 1:1 Help Now