-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit28.pas
183 lines (161 loc) · 4.22 KB
/
Unit28.pas
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
unit Unit28;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Imaging.pngimage,
Vcl.ExtCtrls,JPEG;
type
TForm28 = class(TForm)
accessories: TImage;
acspic: TImage;
add: TImage;
addpic: TImage;
bg: TImage;
circles: TImage;
coloradd: TImage;
colorcr: TImage;
colordlg: TColorDialog;
colorpen: TComboBox;
colorplanet: TComboBox;
crc: TImage;
create: TImage;
emotions: TComboBox;
emotionspic: TImage;
eyes: TImage;
eyespic: TImage;
history: TMemo;
name: TEdit;
pen: TImage;
planet: TImage;
Panel1: TPanel;
SaveDialog1: TSaveDialog;
procedure circlesClick(Sender: TObject);
procedure colorcrClick(Sender: TObject);
procedure colorpenChange(Sender: TObject);
procedure colorplanetChange(Sender: TObject);
procedure emotionsChange(Sender: TObject);
procedure eyespicClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure addClick(Sender: TObject);
procedure createClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form28: TForm28;
path1,path2,path3:string;
clickeyes,clickadd,w,xx,clickacs,clickcr,w1:integer;
bmp: TBitmap;
jpg: TJPEGImage;
DC: hDC;
save:string;
implementation
uses unit9;
{$R *.dfm}
procedure TForm28.addClick(Sender: TObject);
begin
if clickadd<=10 then
clickadd:=clickadd+1 else clickadd:=1;
addpic.Picture.LoadFromFile(path1+'\ïðèøåëüöû îäåæäà\îäåæäà\'+inttostr(clickadd)+'.png')
end;
procedure TForm28.circlesClick(Sender: TObject);
begin
w1:=2;
if clickcr<=9 then
clickcr:=clickcr+1 else clickcr:=0;
colorcr.Visible:=true;
if clickcr=0 then colorcr.Visible:=false;
crc.Picture.LoadFromFile(path1+'\ïðèøåëüöû îäåæäà\ïðè÷è\'+inttostr(clickcr)+'.png')
end;
procedure TForm28.colorcrClick(Sender: TObject);
begin
path3:=path1+'\ïðèøåëüöû îäåæäà\ïðè÷è\'+inttostr(clickcr)+'\';
crc.Picture.LoadFromFile(path3+inttostr(w1)+'.png');
if w1<17 then w1:=w1+1 else w1:=1;
end;
procedure TForm28.colorpenChange(Sender: TObject);
var i:integer;
begin
with colorpen do
for i := 0 to 20 do
begin
if itemindex=i then
pen.picture.LoadFromFile(path1+'ïðèøåëüöû îäåæäà\ñâå÷åíèå\'+inttostr(i+1)+'.png');
end;
end;
procedure TForm28.colorplanetChange(Sender: TObject);
var i:integer;
begin
with colorplanet do
for i := 0 to 19 do
begin
if itemindex=i then
planet.picture.LoadFromFile(path1+'ïðèøåëüöû îäåæäà\òåëî. öâåò\'+inttostr(i+1)+'.png');
end;
end;
procedure TForm28.createClick(Sender: TObject);
begin
savedialog1.FileName:= name.Text;
bmp.Free;
bmp := TBitmap.Create;
try
DC := GetDC(panel1.Handle);
try
bmp.Width := panel1.Width;
bmp.Height := panel1.Height;
// ïîëó÷àåì ñíèìîê
BitBlt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
DC, 0, 0, SRCCOPY);
finally
ReleaseDC(DC, panel1.Handle);
end;
// êîíâåðòèðóåì Bitmap â JPEG è ñîõðàíÿåì
jpg:= TJPEGImage.Create;
if savedialog1.Execute then
save:=savedialog1.FileName+'.jpg';
try
jpg.Assign(bmp);
jpg.SaveToFile(save);
finally
jpg.Free;
end;
finally
bmp.Free;
end;
end;
procedure TForm28.emotionsChange(Sender: TObject);
var i:integer;
begin
with emotions do
for i := 0 to 13 do
begin
if itemindex=i then begin
emotionspic.picture.LoadFromFile(path1+'ïðèøåëüöû îäåæäà\ýìîöèè\'+inttostr(i+1)+'.png'); eyes.Visible:=true; end;
if ((itemindex=12) or (itemindex=11) or (itemindex=10) or (itemindex=5)) then eyes.Visible:=false;
if (itemindex=7) then begin eyes.BringToFront; acspic.BringToFront; end;
end;
end;
procedure TForm28.eyespicClick(Sender: TObject);
begin
if ((emotions.ItemIndex=10) or (emotions.ItemIndex=11) or (emotions.ItemIndex=5 )or (emotions.ItemIndex=12)) then
form28.showmodal else begin
if clickeyes<=18 then
clickeyes:=clickeyes+1 else clickeyes:=1;
eyes.Picture.LoadFromFile(path1+'\ïðèøåëüöû îäåæäà\ãëàç(à)\'+inttostr(clickeyes)+'.png')
end;
end;
procedure TForm28.FormCreate(Sender: TObject);
begin
path1:=extractfiledir(application.ExeName);
form28.Cursor:=1;
emotions.ItemIndex:=0;
colorpen.ItemIndex:=0;
colorplanet.ItemIndex:=12;
clickeyes:=1;
clickadd:=0;
clickacs:=1;
path1:=path1+'\';
end;
end.