Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Framing Text onto a Form

Status
Not open for further replies.

Glenn9999

Programmer
Joined
Jun 19, 2004
Messages
2,312
Location
US
I've been working on a screen saver demo (to post in FAQs here perhaps), and I have run into my same problem I run into with a lot of programs now: How do I place a text label onto a form dynamically so the entire text appears? What I've been trying is something like this for placing the text in the upper right hand corner of the screen:

Code:
label1.left := Form1.ClientWidth - Label1.Width;
label1.top := Form1.ClientHeight - Label1.Height;

But occasionally the text still goes off the right side of the form. Any ideas here?
 
If you want the label to be in the upper right hand corner then surely your second line of code should be
Code:
label1.top := 0;
otherwise your code looks okay to me.

However, it might be a good idea to put this code in the OnResize event handler for the form so that if the size of the form is changed by program or user then the label gets moved to its required position.

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top