![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Центр экрана!!! [D7, Win95/98, WinXP]
Шалунишка © (2004-06-20 14:52:00)Доюрый день!!! Подскажите ПОЖАЛУЙСТА как свою пргграммку расположить точно по середине экрана ?!! Зараннее благодарен...
Шалунишка (2004-06-20 22:08:00) [1]Спасибо всем всем всем!!! Для Nick'а Denry , Ну это я так, на самом деле я Dextor (Dextor-and.narod.ru, Dextor-and@yandex.ru);
//P.S. Я еще вернусь!
YurikGL (2004-06-20 21:21:00) [2]Среди свойств формы есть position
poDesignedThe form appears positioned on the screen and with the same height and width as it had at design time.
poDefault The form appears in a position on the screen and with a height and width determined by the operating system.
poDefaultPosOnlyThe form displays with the size you created it at design time, but the operating system chooses its position on the screen.
poDefaultSizeOnlyThe form appears in the position you left it at design time, but the operating system chooses its size.
poScreenCenterThe form remains the size you left it at design time, but is positioned in the center of the screen. Note that in multi-monitor applications, this may result in a form that does not fall entirely on one monitor, because CLX does not include multi-monitor support.
poDesktopCenter The form remains the size you left it at design time, but is positioned in the center of the screen.
poMainFormCenterThe form remains the size you left it at design time, but is positioned in the center of the application’s main form. This position should only be used with secondary forms. If set for a main form, it acts like poScreenCenter.
poOwnerFormCenterThe form remains the size you left it at design time, but is positioned in the center of the form specified by the Owner property. If the Owner property does not specify a form, this position acts like poMainFormCenter.
Выбирай нужную
grom (2004-06-20 20:51:00) [3]Mim1 © (20.06.04 19:02) [6]
mожно использовать и poScreenCenter
результат будет тот же
Nick Denry (2004-06-20 20:01:00) [4]2>Автор ветки
>А обзываться не зачем !!!
А я и не обзавылся... просто ник у тебя ... ну скажем странный :))
Не обижайся :))
По теме: если хочешь по центру экрана, а не рабочего стола, то еще нужно вычесь координаты панели задач (правда есть еще какой-то метод, но я не помню)..
SHAppBarMessage(ABM_QUERYPOS,wbs); - КООРДИНАТЫ ПАНЕЛИ ЗАДАЧ
Mim1 (2004-06-20 19:02:00) [5]
> [3] grom (20.06.04 15:47)
Надо заметить что приведенный вами код (обработчик события TForm и глобальный обьект screen) относится к vcl. А в vcl у формы есть специальное свойство отвечающее за распоодение окна в центре экрана, десктопа и т.д.
Шалунишка (2004-06-20 16:23:00) [6]>>VMcL
А если можно скажите пожалуйста так и так!!! Очень вас прошу.
>>grom
Спасибо
>> Nick Denry
Спасибо
VMcL (2004-06-20 15:54:00) [7]>>Шалунишка (20.06.04 14:52)
Посередине видимой части экрана или посередине рабочей части экрана?
grom (2004-06-20 15:47:00) [8]a можно вот-так
procedure TForm1.FormShow(Sender: TObject);
begin
Left:=trunc((Screen.Width-Width)/2);
Top:=trunc((Screen.Height-Height)/2);
end;
Шалунишка (2004-06-20 15:18:00) [9]А обзываться не зачем !!!
Nick Denry (2004-06-20 15:06:00) [10]держи, противный... :))))
var desktop_rect : TRect;
{'заполнение переменных xPos,yPos,nWidth,nHeight}
SystemParametersInfo(SPI_GETWORKAREA,0,@desktop_rect,0);
nWidth:=271;
nHeight:=271;
xPos:=(desktop_rect.Right div 2)-(nWidth div 2);
yPos:=(desktop_rect.Bottom div 2)-(Nheight div 2);
{ Создание главного окна}
SCDWnd:=CreateWindowEx (
0 , //флаги расширенных стилей
'SystemCD : Main', //имя класса окна, данное при заполнении структуры SystemCD
'SystemCD v.3.1', //заголовок окна
ws_popup , //флаги стилей окна
{подробнdее о стилях см. после текста программы}
xPos, //горизонтальная позиция окна
yPos, //вертикальная позиция окна
nWidth, //ширина окна
nHeight, //высота окна
0, //описатель родительского окна (parent) или окна-владельца (owner)
0, //описатель меню окна (меню нет, нет и описателя)
Hinstance, //описатель приложения
nil //address of window-creation data
);
{ShowWindow(SCDWnd,CmdShow); //Отображаем окно}