Delphi在窗體上生成實現藝術字效果,有多種效果:水平線效果、垂直線效果、向下延伸和向上延伸、曲線效果。覺得代碼挺不錯,想學習的就看看下面的代碼吧:
這是運行的效果圖,具體實現代碼:
01
unit
Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
05
Dialogs, StdCtrls, ExtCtrls, ExtDlgs;
06
type
07
TForm1 =
class
(TForm)
08
Button1: TButton;
09
ListBox1: TListBox;
10
Label1: TLabel;
11
Image1: TImage;
12
Button2: TButton;
13
CheckBox1: TCheckBox;
14
SavePictureDialog1: TSavePictureDialog;
15
procedure
Button1Click(Sender: TObject);
16
Button2Click(Sender: TObject);
17
private
18
{ Private declarations }
19
public
20
{ Public declarations }
21
end
;
22
const
ch:
Array
[
0..7
]
of
String
=(
'漂'
,
'亮'
'的'
'藝'
'術'
'字'
'效'
'果'
);
23
var
24
Form1: TForm1;
25
implementation
26
{$R *.dfm}
27
TForm1
.
28
i:
Integer
29
begin
30
Image1
Canvas
Brush
Color:=clBlack;
31
FillRect(Rect(
0
,Width,Height));
32
with
Do
33
Begin
34
For
i:=
to
7
35
36
canvas
Font
Size:=
//設置字體大小
37
Case
ListBox1
ItemIndex
Of
38
:
39
setbkmode(canvas
Handle,
1
//設置字體模式為透明
40
If
checkBox1
Checked
Then
41
42
Color:=clwhite;
//設置浮雕顏色
43
TextOut(
*i,
100
,ch[i]);
//水平直線效果
44
45
Color:=clBlue;
//設置顏色
46
+
4
47
48
49
50
51
52
Color:=clred;
53
,Round(
*i),ch[i]);
//豎直直線效果
54
55
Color:=RGB(
-
255
154
56
6
57
58
2
59
60
61
62
63
*i,Round(
//向下延伸直線效果
64
65
*i);
66
*i+
*i)+
67
68
3
69
70
71
72
Color:=clFuchsia;
73
200
//向上延伸直線效果
74
75
//設置文字漸變顏色
76
//向上延伸直線效果偏移
77
78
//曲線效果
79
80
//是否設置浮雕
81
82
83
*i*i)+
84
85
86
//曲線效果偏移
87
88
89
90
91
92
93
94
SavePictureDialog1
Execute
95
Picture
SaveToFile(SavePictureDialog1
FileName);
//將藝術字效果保存
96
97
本例效果圖:代碼文件:unit Unit1;i
本例效果圖:unit Unit1; interface
TIWCalendar: 日歷控件, 繼承於 TIWCus
先虛擬一個測試文件: test.xml; 放在 c:\t
這包括://屬性 IGPBitmap.Pixels;