home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 April A
/
Pcwk4a98.iso
/
PROGRAM
/
DELPHI16
/
KTMBEVEL
/
UNIT1.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1997-11-18
|
9KB
|
353 lines
unit Unit1;
interface
uses
{$IFDEF Win32} Windows, {$ELSE}WinTypes, WinProcs, {$ENDIF}Messages, SysUtils,
Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Spin,
ktMBevel;
type
TForm1 = class(TForm)
ktMultiBevel1: TktMultiBevel;
ktMultiBevel2: TktMultiBevel;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
SpinEdit4: TSpinEdit;
SpinEdit5: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
ColorDialog1: TColorDialog;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
RadioGroup3: TRadioGroup;
RadioGroup4: TRadioGroup;
RadioGroup5: TRadioGroup;
CheckBox1: TCheckBox;
ComboBox1: TComboBox;
ktBevelButton1: TktBevelButton;
Exit: TLabel;
Label12: TLabel;
SpinEdit6: TSpinEdit;
Label13: TLabel;
SpinEdit7: TSpinEdit;
RadioGroup6: TRadioGroup;
procedure FormCreate(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
procedure Panel1Click(Sender: TObject);
procedure Panel2Click(Sender: TObject);
procedure Panel3Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure RadioGroup3Click(Sender: TObject);
procedure RadioGroup4Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure SpinEdit3Change(Sender: TObject);
procedure SpinEdit4Change(Sender: TObject);
procedure Panel4Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure RadioGroup5Click(Sender: TObject);
procedure SpinEdit5Change(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ktBevelButton1Click(Sender: TObject);
procedure ktBevelButton1Exit(Sender: TObject);
procedure ktBevelButton1Enter(Sender: TObject);
procedure ktBevelButton1MouseDown(Sender: TObject);
procedure RadioGroup6Click(Sender: TObject);
procedure SpinEdit7Change(Sender: TObject);
procedure SpinEdit6Change(Sender: TObject);
private
{ Private-Deklarationen }
Bmp: TBitmap;
SStyle: TShadowStyle;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
Bmp:= TBitmap.Create;
Bmp.LoadfromFile(ExtractFilePath(Application.ExeName) + 'Demo.bmp');
ktMultiBevel1.BevelWidth:= SpinEdit1.Value;
ktMultiBevel1.BorderWidth:= SpinEdit2.Value;
ktMultiBevel1.ShadowOffsetX:= SpinEdit3.Value;
ktMultiBevel1.ShadowOffsetY:= SpinEdit4.Value;
ktMultiBevel1.EdgeSize:= SpinEdit5.Value;
ktMultiBevel1.ShadowDensity:= SpinEdit6.Value;
CheckBox1.Checked:= ktMultiBevel1.Shadowed;
ComboBox1.ItemIndex:= 2;
SStyle:= ktBevelButton1.ShadowStyle;
ktBevelButton1.ShadowStyle:= ssTransparent;
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
ktMultiBevel1.BevelWidth:= SpinEdit1.Value;
end;
procedure TForm1.SpinEdit2Change(Sender: TObject);
begin
ktMultiBevel1.BorderWidth:= SpinEdit2.Value;
end;
procedure TForm1.SpinEdit3Change(Sender: TObject);
begin
ktMultiBevel1.ShadowOffsetX:= SpinEdit3.Value;
end;
procedure TForm1.SpinEdit4Change(Sender: TObject);
begin
ktMultiBevel1.ShadowOffsetY:= SpinEdit4.Value;
end;
procedure TForm1.SpinEdit5Change(Sender: TObject);
begin
ktMultiBevel1.EdgeSize:= SpinEdit5.Value;
end;
procedure TForm1.SpinEdit6Change(Sender: TObject);
begin
if not ktMultiBevel1.DensityDepended then
ktMultiBevel1.ShadowDensity:= SpinEdit6.Value;
end;
procedure TForm1.SpinEdit7Change(Sender: TObject);
var v: Integer;
begin
try
v:= SpinEdit7.Value;
except
SpinEdit7.Value:= 0;
v:= SpinEdit7.Value;
end;
ktMultiBevel1.ColorDensity:= v;
case v of
0 : RadioGroup5.ItemIndex:= 2;
1..99 : RadioGroup5.ItemIndex:= 1;
100 : RadioGroup5.ItemIndex:= 0;
end;
if ktMultiBevel1.DensityDepended then SpinEdit6.Value:= Round(v * 60 / 100);
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
ktMultiBevel1.Shadowed:= CheckBox1.Checked;
end;
procedure TForm1.Panel1Click(Sender: TObject);
begin
ColorDialog1.Color:= Panel1.Color;
if ColorDialog1.Execute then
begin
Panel1.Color:= ColorDialog1.Color;
ktMultiBevel1.Color:= Panel1.Color;
if ktMultiBevel1.ColorFixed then
begin
Panel2.Color:= ktMultiBevel1.ColorHighlight;
Panel3.Color:= ktMultiBevel1.ColorShadow;
end;
end;
end;
procedure TForm1.Panel2Click(Sender: TObject);
begin
ColorDialog1.Color:= Panel2.Color;
if ColorDialog1.Execute then
if not ktMultiBevel1.ColorFixed then
begin
Panel2.Color:= ColorDialog1.Color;
ktMultiBevel1.ColorHighlight:= Panel2.Color;
end;
end;
procedure TForm1.Panel3Click(Sender: TObject);
begin
ColorDialog1.Color:= Panel3.Color;
if ColorDialog1.Execute then
if not ktMultiBevel1.ColorFixed then
begin
Panel3.Color:= ColorDialog1.Color;
ktMultiBevel1.ColorShadow:= Panel3.Color;
end;
end;
procedure TForm1.Panel4Click(Sender: TObject);
begin
ColorDialog1.Color:= Panel4.Color;
if ColorDialog1.Execute then
begin
Panel4.Color:= ColorDialog1.Color;
ktMultiBevel1.ShadowColor:= Panel4.Color;
end;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case RadioGroup1.ItemIndex of
0 : ktMultiBevel1.Shape:= bspBottomLine;
1 : ktMultiBevel1.Shape:= bspLeftLine;
2 : ktMultiBevel1.Shape:= bspPortrait;
3 : ktMultiBevel1.Shape:= bspRect;
4 : ktMultiBevel1.Shape:= bspRightLine;
5 : ktMultiBevel1.Shape:= bspTopLine;
end;
RadioGroup3.Enabled:= ((RadioGroup1.ItemIndex = 2) or (RadioGroup1.ItemIndex = 3));
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
begin
case RadioGroup2.ItemIndex of
0 : ktMultiBevel1.BevelOuter:= bstLowered;
1 : ktMultiBevel1.BevelOuter:= bstNone;
2 : ktMultiBevel1.BevelOuter:= bstRaised;
end;
end;
procedure TForm1.RadioGroup3Click(Sender: TObject);
begin
case RadioGroup3.ItemIndex of
0 : ktMultiBevel1.BevelInner:= bstLowered;
1 : ktMultiBevel1.BevelInner:= bstNone;
2 : ktMultiBevel1.BevelInner:= bstRaised;
end;
end;
procedure TForm1.RadioGroup4Click(Sender: TObject);
begin
case RadioGroup4.ItemIndex of
0 : begin
ktMultiBevel1.ColorFixed:= True;
Panel2.Color:= ktMultiBevel1.ColorHighlight;
Panel3.Color:= ktMultiBevel1.ColorShadow;
end;
1 : ktMultiBevel1.ColorFixed:= False;
end;
end;
procedure TForm1.RadioGroup5Click(Sender: TObject);
begin
case RadioGroup5.ItemIndex of
0 : ktMultiBevel1.Transparence:= trNone;
1 : ktMultiBevel1.Transparence:= trSemi;
2 : begin
ktMultiBevel1.Transparence:= trTransparent;
CheckBox1.Checked:= False;
end;
end;
SpinEdit7.Value:= ktMultiBevel1.ColorDensity;
SpinEdit6.Value:= ktMultiBevel1.ShadowDensity;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
with ktMultiBevel1 do
begin
case ComboBox1.ItemIndex of
0 : ShadowStyle:= ssBlack;
1 : ShadowStyle:= ssCopy;
2 : ShadowStyle:= ssDithered;
3 : ShadowStyle:= ssMask;
4 : ShadowStyle:= ssMaskNotPen;
5 : ShadowStyle:= ssMerge;
6 : ShadowStyle:= ssMergeNotPen;
7 : ShadowStyle:= ssNot;
8 : ShadowStyle:= ssNotAND;
9 : ShadowStyle:= ssNotCopy;
10: ShadowStyle:= ssNotMask;
11: ShadowStyle:= ssNotMerge;
12: ShadowStyle:= ssNotOR;
13: ShadowStyle:= ssNotXor;
14: ShadowStyle:= ssTransparent;
15: ShadowStyle:= ssWhite;
16: ShadowStyle:= ssXor;
end;
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
x, y: Integer; r: TRect;
begin
r:= rect(Width div 2,0,Width,Height);
Canvas.Brush.Color:= clBtnFace;
Canvas.FillRect(r);
y := 0;
while y < Height do
begin
x := 0;
while x < Width div 2 do
begin
Canvas.Draw(x, y, Bmp);
x := x + Bmp.Width;
end;
y := y + Bmp.Height;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Bmp.Free;
end;
procedure TForm1.ktBevelButton1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.ktBevelButton1Exit(Sender: TObject);
begin
ktBevelButton1.ShadowStyle:= ssTransparent;
end;
procedure TForm1.ktBevelButton1Enter(Sender: TObject);
begin
ktBevelButton1.ShadowStyle:= SStyle;
end;
procedure TForm1.ktBevelButton1MouseDown(Sender: TObject);
begin
ktBevelButton1.ShadowStyle:= ssTransparent;
end;
procedure TForm1.RadioGroup6Click(Sender: TObject);
begin
case RadioGroup6.ItemIndex of
0 : begin
ktMultiBevel1.DensityDepended:= True;
// := ktMultiBevel1.ColorHighlight;
end;
1 : ktMultiBevel1.DensityDepended:= False;
end;
end;
end.