Delphi의 창 전체 화면 구성 요소
23954 단어 Delphi
1
{
*******************************************************
}
2
{
}
3
{
TFullScreen
}
4
{
Ver 0.1.1
}
5
{
Copyright(C) 2006-2007 Unruly Wolf Soft
}
6
{
}
7
{
*******************************************************
}
8
9
unit
FullScreen;
10
11
interface
12
13
uses
14
SysUtils, Classes,Forms,Windows;
15
16
type
17
TFullScreen
=
class
(TComponent)
18
private
19
{
Private declarations
}
20
FFullScreenMode : Boolean;
21
FForm : TCustomForm;
22
OldState,OldHeight,OldWidth,OldX,OldY:Longint;
23
FOldState:TWindowState;
24
FBeforeFullScreen:TNotifyEvent ;
25
FAfterModeChanged:TNotifyEvent ;
26
FAfterFullScreen:TNotifyEvent ;
27
FExitFullScreen:TNotifyEvent ;
28
Procedure SetFullScreenMode(aVal:Boolean);
29
protected
30
{
Protected declarations
}
31
public
32
{
Public declarations
}
33
property
FullScreen : Boolean
read
FFullScreenMode
write
SetFullScreenMode;
34
property
FormMain : TCustomForm
read
FForm
write
FForm;
35
procedure
SaveOldWinState;
36
published
37
{
Published declarations
}
38
property
BeforeFullScreen : TNotifyEvent
read
FBeforeFullScreen
write
FBeforeFullScreen;
39
property
AfterModeChanged : TNotifyEvent
read
FAfterModeChanged
write
FAfterModeChanged;
40
property
AfterFullScreen : TNotifyEvent
read
FAfterFullScreen
write
FAfterFullScreen;
41
property
ExitFullScreen : TNotifyEvent
read
FExitFullScreen
write
FExitFullScreen;
42
end
;
43
44
procedure
Register;
45
46
implementation
47
48
49
//
Save form state
50
procedure
TFullScreen.SaveOldWinState ;
51
begin
52
if
FForm
<>
nil
then
53
FOldState:
=
FForm.WindowState ;
54
end
;
55
56
procedure
TFullScreen.SetFullScreenMode(aVal:Boolean);
57
begin
58
if
aVal
<>
FFullScreenMode
then
59
begin
60
FFullScreenMode:
=
aVal;
61
if
FFullScreenMode
then
62
//
enter fullscreen
63
begin
64
OldState:
=
GetWindowLong(FForm.Handle, GWL_STYLE);
65
OldHeight:
=
FForm.Height;
66
OldWidth:
=
FForm.Width;
67
OldX:
=
FForm.Left ;
68
OldY:
=
FForm.Top;
69
SaveOldWinState;
70
if
Assigned(FBeforeFullScreen)
then
FBeforeFullScreen(Self);
71
FForm.Left:
=
0
;
72
FForm.Top:
=
0
;
73
FForm.windowstate:
=
wsmaximized;
74
SetWindowLong(FForm.Handle, GWL_STYLE,
75
GetWindowLong(FForm.Handle, GWL_STYLE) AND NOT WS_CAPTION);
76
//
FForm.windowstate:
=
wsmaximized;
77
FForm.clientHeight:
=
screen.Height;
78
FForm.Refresh;
79
if
Assigned(FAfterFullScreen)
then
FAfterFullScreen(Self);
80
end
81
else
82
//
Exit full screen
83
begin
84
SetWindowLong(FForm.Handle, GWL_STYLE, OldState);
85
FForm.Height:
=
OldHeight;
86
FForm.Width:
=
OldWidth;
87
FForm.Left:
=
OldX;
88
FForm.Top:
=
OldY;
89
FForm.Windowstate:
=
FOldState;
90
FForm.Refresh;
91
if
Assigned(FExitFullScreen)
then
FExitFullScreen(Self);
92
end
;
93
end
;
94
if
Assigned(FAfterModeChanged)
then
FAfterModeChanged(Self);
95
end
;
96
97
procedure
Register;
98
begin
99
RegisterComponents(
'
UWS Used
'
, [TFullScreen]);
100
end
;
101
102
end
.
103
구성 요소 다운로드:http://files.cnblogs.com/uws2056/FullScreen.rar
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[Delphi] TStringBuilder그리고 꼭 사용해야만 할까? 그림처럼 Heap 영역에 "Hello" 공간을 생성하고 포인팅을 한다. "Hello World" 공간을 새로 생성한 후 포인팅을 하게 된다. 결국 "Hello" 라는 String 객체가 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.