-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplayUnit.cpp
60 lines (56 loc) · 2.4 KB
/
DisplayUnit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "DisplayUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//TDisplayForm *DisplayForm;
//---------------------------------------------------------------------------
__fastcall TDisplayForm::TDisplayForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TDisplayForm::FormResize(TObject *Sender) //ïîäñòðàèâàåì âñå ïàíåëè ïîä òåêóùèé ðàçìåð îêíà
{
//main panels
int w;
w = this->Width * 0.40 - this->BorderWidth; //âû÷èñëÿåì øèðèíó áîêîâûõ ïàíåëåé (ó÷èòûâàÿ îòñòóï)0
LeftPanel->Width = w;
RightPanel->Width = w;
TopPanel->Height = this->Height*0.35 - this->BorderWidth*2; //ó÷èòûâàåì ðàìêó ñíèçó è ñâåðõó
if ((CentralTopPanel->Width *2) < (CentralPanel->Height * 0.99)) //ñìîòðèì, ÷òîáû ïàíåëüêè íå ïåðåñåêàëèñü
{
CentralTopPanel->Height = CentralTopPanel->Width; //äåëàåì êâàäðàòíûìè ïàíåëüêè ëîãîòèïîâ
CentralBottomPanel->Height = CentralBottomPanel->Width;
}
else
{
int h;
h = CentralPanel->Height * 0.495;
CentralTopPanel->Height = h;
CentralBottomPanel->Height = h;
};
//top panel
CategoryPanel->Height = TopPanel->Height*0.2;
w = CategoryPanel->Width * 0.33;
Player1Label->Width = w;
Player2Label->Width = w;
//player scores panels
Player1Scores->Height = LeftPanel->Height * 0.6;
Player1Advantage->Width = LeftPanel->Width * 0.5;
Player2Scores->Height = RightPanel->Height * 0.6;
Player2Advantage->Width = RightPanel->Width * 0.5;
}
//---------------------------------------------------------------------------
void __fastcall TDisplayForm::FormCreate(TObject *Sender)
{
//âûñòàâëÿåì ïîëîæåíèå îêíà ïî öåíòðó
if (Screen->MonitorCount > 1)
{
this->Left =Screen->Monitors[1]->Left + (Screen->Monitors[1]->Width - this->Width) / 2;
this->Top = Screen->Monitors[1]->Top + (Screen->Monitors[1]->Height - this->Height) / 2;
};
}
//---------------------------------------------------------------------------