 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bin Lin Guest
|
Posted: Tue Mar 22, 2005 10:45 pm Post subject: placement of the form |
|
|
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
|
Posted: Tue Mar 22, 2005 11:33 pm Post subject: Re: placement of the form |
|
|
"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 |
|
 |
|
|
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
|
|