Delphi實現嵌入式的時鐘效果,電子鐘,帶指針走動動畫,運行程序後始獲取Windows當前時間,挺基礎的代碼:
01
unit
Unit1;
02
interface
03
uses
04
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
05
Forms, Dialogs, ExtCtrls;
06
type
07
TForm1 =
class
(TForm)
08
Panel1: TPanel;
09
Image1: TImage;
10
Timer1: TTimer;
11
procedure
FormCreate(Sender: TObject);
12
Timer1Timer(Sender: TObject);
13
private
14
{ Private declarations }
15
FirstTime :
Boolean
;
16
vho, vmo, vso :
Real
17
public
18
{ Public declarations }
19
end
20
var
21
Form1: TForm1;
22
implementation
23
{$R *.DFM}
24
TForm1
.
25
26
i :
Integer
27
begin
28
with
Form1
Image1
Canvas
do
29
Pen
Color := clWhite;
30
Style := psSolid;
31
Brush
32
Style := bsSolid;
33
Rectangle(
0
,
,Width,Height);
34
Color := clBlack;
35
for
i:=
1
to
36
Pixels[
+Round(
*Sin(i/
12.0
*
2
*Pi)),
-Round(
*Cos(i/
*Pi))] := clBlack;
37
38
FirstTime :=
True
39
Panel1
Left :=
40
Top :=
41
Width := Form1
Width;
42
Height := Form1
Height;
43
44
45
46
MyNow : TDateTime;
47
Hour, Min,
48
Sec, mSec :
Word
49
vh, vm, vs :
50
51
MyNow := Now;
52
DecodeTime(MyNow,Hour,Min,Sec,mSec);
53
vh := Hour/
*Pi;
54
vm := Min/
60.0
55
vs := Sec/
56
57
if
not
FirstTime
then
58
59
MoveTo(
);
60
LineTo(
*Sin(vho)),
*Cos(vho)));
61
62
*Sin(vmo)),
*Cos(vmo)));
63
64
*Sin(vso)),
*Cos(vso)));
65
66
else
67
False
68
69
70
*Sin(vh)),
*Cos(vh)));
71
72
73
*Sin(vm)),
*Cos(vm)));
74
Color := clRed;
75
76
*Sin(vs)),
*Cos(vs)));
77
78
vho := vh;
79
vmo := vm;
80
vso := vs;
81
82
Delphi xe7 android實現透明度可以調整的對話
本例效果圖:代碼文件:unit Unit1;i
本例將把一張 bmp 圖片, 以資源文件的方式嵌入 dl
//添加顏色變換uses GDIPAPI, GDIPOBJ
本例測試了兩個問題: 1、其他 VCL 加載的圖片能否給
本例效果圖: 代碼文件:unit Unit1;inter