Delphi實現美輪美奂的色彩效果[浮雕、燈光照射]效果,Delphi編織帶效果,可拖動滑塊設置顏色,有兩個簡單點的效果:1、浮雕效果。2、燈光镂射效果。下面是測試圖:
01
unit
Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
05
Dialogs, StdCtrls, ComCtrls, ExtCtrls, ExtDlgs;
06
type
07
TForm1 =
class
(TForm)
08
Button1: TButton;
09
RadioButton1: TRadioButton;
10
RadioButton2: TRadioButton;
11
RadioButton3: TRadioButton;
12
TrackBar1: TTrackBar;
13
Label1: TLabel;
14
Image1: TImage;
15
Button2: TButton;
16
SavePictureDialog1: TSavePictureDialog;
17
procedure
Button1Click(Sender: TObject);
18
Button2Click(Sender: TObject);
19
private
20
{ Private declarations }
21
public
22
{ Public declarations }
23
end
;
24
var
25
Form1: TForm1;
26
implementation
27
{$R *.dfm}
28
TForm1
.
29
const
step=
//正方形的邊長
30
n,i,j:
Integer
31
begin
32
Form1
Repaint;
33
For
n:=
0
to
do
//漸變的數量
34
i:=
To
DO
//控制水平填充效果
35
j:=
//控制豎直填充效果
36
37
With
Image1
Do
38
Begin
39
If
RadioButton1
Checked
Then
40
Canvas
Brush
Color:=RGB(
255
-
*n,
*n)
//浮雕色,也可以進行其他的設置
41
Else
RadioButton2
42
Color:=RGB(TrackBar1
Position,
//镂射效果的燈光顏色
43
RadioButton3
44
Color:=RGB(Random(
),random(
),Random(
));
//編織帶顏色設置
45
//這一行代碼控制水平效果輸出
46
FillRect(Rect(i,n,(i+
1
)*step,n+
// 水平漸變
47
//這兩行代碼控制豎直效果輸出
48
FillRect(Rect(i,j*step+n,(i+
)*step,j*step+n+
//豎直漸變
49
FillRect(Rect((i+
)*step+n,j*step,(i+
)*step+n+
,j*step+step));
50
51
52
53
54
55
SavePictureDialog1
Execute
56
Picture
SaveToFile(SavePictureDialog1
FileName);
//保存特殊效果
57
58
R-Tree 主要用於三維空間的搜索, 據說這種搜索算法非
前言:“搶三十”是中國
TGPColor 是 GdiPlus 的顏色主體, 它雖然
Delphi之所以能在.NET與JAVA&l
同對象關聯前面說了我們可以將字符串同對象綁定起來,我們可以
本例效果圖: 代碼文件:unit Unit1;inter