Delphi制作的鏡框效果,可選擇多種不同的顏色相框,類似於窗口的換膚功能。在相框上點擊右鍵,可選擇圖片等。示例效果圖所示:
01
unit
Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
05
Dialogs, StdCtrls, ExtCtrls, jpeg, Menus, ExtDlgs,INIFILES;
06
type
07
TForm1 =
class
(TForm)
08
PopupMenu1: TPopupMenu;
09
N1: TMenuItem;
10
Panel1: TPanel;
11
Image1: TImage;
12
Label1: TLabel;
13
Label2: TLabel;
14
N2: TMenuItem;
15
N3: TMenuItem;
16
N4: TMenuItem;
17
N5: TMenuItem;
18
N6: TMenuItem;
19
N7: TMenuItem;
20
OpenPictureDialog1: TOpenPictureDialog;
21
procedure
N1Click(Sender: TObject);
22
N2Click(Sender: TObject);
23
FormCreate(Sender: TObject);
24
N4Click(Sender: TObject);
25
N5Click(Sender: TObject);
26
N6Click(Sender: TObject);
27
private
28
WMNCHitTest(
var
Msg:TWMNCHitTest);message WM_NCHITTEST;
29
public
30
{ Public declarations }
31
end
;
32
33
Form1: TForm1;
34
theme:TInifile;
35
themename,form_color,panel_color,Label_color:
string
36
implementation
37
{$R *.dfm}
38
TForm1
.
Msg:TWMNCHitTest);
39
begin
40
DefaultHandler(Msg);
41
if
Msg
Result = HTCLIENT
then
42
Result:= HTCAPTION;
43
44
45
46
Close;
//退出程序
47
48
49
50
If
OpenPictureDialog1
Execute
Then
51
Image1
Picture
LoadFromFile(OpenPictureDialog1
FileName);
//載入圖象文件
52
53
54
55
Theme:=TIniFile
Create(
'themes.ini'
);
56
57
58
59
Label2
Caption:=theme
ReadString(
'theme1'
,
'name'
'濃烈型'
60
Form1
Color:=StringToColor(theme
,form_color,
'clPurple'
));
61
panel1
,panel_color,
'clMaroon'
62
Font
,Label_color,
'clwhite'
63
64
65
66
'清新型'
67
'$00EC83F1'
68
'$00F365BA'
69
'clBlue'
70
71
72
73
'古樸型'
74
'clBackground'
75
'clblack'
76
77
78
本例效果圖:代碼文件:unit Unit1;i
pq: &nb
本例效果圖: 代碼文件:unit Unit1;inte
可有可無的東西, 因為沒有它也可以方便達成其目的, 使用它
本例效果圖: 代碼文件:unit Unit1;inter