BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

placement of the form

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Bin Lin
Guest





PostPosted: Tue Mar 22, 2005 10:45 pm    Post subject: placement of the form Reply with quote



I want to place the form at the right bottom corner of the screen when I
launch my program, independent of the actual screen size and resolution.
However, the TCustomForm::Position only has propertied like { poDesigned,
poDefault, poDefaultPosOnly, poDefaultSizeOnly, poScreenCenter,
poDesktopCenter, poMainFormCenter, poOwnerFormCenter }.

Any suggestion will be appreciated.

Bin



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Mar 22, 2005 11:33 pm    Post subject: Re: placement of the form Reply with quote




"Bin Lin" <binlin (AT) cs (DOT) northwestern.edu> wrote


Quote:
I want to place the form at the right bottom corner of the screen when
I launch my program, independent of the actual screen size and resolution.

Move the form manually after it has been created:

Form->Left = (Screen->Width - Form->Width);
Form->Top = (Screen->Height - Form->Height);

That displays the form on the primary monitor in a multi-monitor system. If
you want to display the form on a different monitor then do the following
instead:

TRect R;

if( Screen->MonitorCount > 0 )
{
TMonitor *Monitor = Screen->Monitors[SomeIndex];
R = Rect(Monitor->Left, Monitor->Top, Monitor->Left +
Monitor->Width, Monitor->Top + Monitor->Height);
}
else
R = Rect(0, 0, Screen->Width, Screen->Height);

Form->Left = (R.Right - Form->Width);
Form->Top = (R.Bottom - Form->Height);


You may also want to take the taskbar and user-defined appbars into account
as well:

RECT R;

if( Screen->MonitorCount > 0 )
{
MONITORINFO Info = {sizeof(MONITORINFO), 0};
::GetMonitorInfo(Screen->Monitors[SomeIndex]->Handle, &Info);
R = Info.rcWork;
}
else
SystemParametersInfo(SPI_GETWORKAREA, 0, &R, 0);

Form->Left = (R.right - Form->Width);
Form->Top = (R.bottom - Form->Height);


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.