You are on page 1of 230

Delphi XE2 FireMonkey

Delphi XE2 FireMonkey


Delphi XE2
Delphi Delphi
http://www.delphiXEbbs.com

Delphi XE2 FireMonkey (1)


Delphi XE2 FireMonkey , Windows ( 32 Win7)
.

, , ,
, Win8 WinRT .

, Delphi XE2 , :
BdeDataDatasnapFMXIBMacapiPosixSoapSystemSystem.BindingsSyste
m.GenericsSystem.InternalSystem.MacSystem.WinVclWinapiXml...

, . FireMonkey :

FMX.Ani.pas
FMX.ASE.Importer.pas
FMX.ASE.Lexer.pas
FMX.ASE.Model.pas
FMX.Canvas.D2D.pas
FMX.Canvas.GDIP.pas
FMX.Canvas.Mac.pas
FMX.Colors.pas
FMX.Consts.pas
FMX.Context.DX9.pas
FMX.Context.Mac.pas
FMX.Controls.pas
FMX.DAE.Importer.pas
FMX.DAE.Model.pas
FMX.DAE.Schema.pas

www.DelphiXEbbs.com

Delphi XE2 FireMonkey


FMX.Dialogs.pas
FMX.Edit.pas
FMX.Effects.pas
FMX.ExtCtrls.pas
FMX.Filter.Effects.pas
FMX.Filter.pas
FMX.FilterCatBlur.pas
FMX.FilterCatColor.pas
FMX.FilterCatColorAdjust.pas
FMX.FilterCatComposite.pas
FMX.FilterCatDistortion.pas
FMX.FilterCatGenerator.pas
FMX.FilterCatGeometry.pas
FMX.FilterCatStyle.pas
FMX.FilterCatTiles.pas
FMX.FilterCatTransition.pas
FMX.Forms.pas
FMX.Grid.pas
FMX.Import.pas
FMX.Layers3D.pas
FMX.Layouts.pas
FMX.ListBox.pas
FMX.Memo.pas
FMX.Menus.pas
FMX.OBJ.Importer.pas
FMX.OBJ.Model.pas
FMX.Objects.pas
FMX.Objects3D.pas
FMX.Platform.Mac.pas
FMX.Platform.pas
FMX.Platform.Win.pas
FMX.Printer.Mac.pas
FMX.Printer.pas
FMX.Printer.Win.pas

www.DelphiXEbbs.com

Delphi XE2 FireMonkey


FMX.TabControl.pas
FMX.TreeView.pas
FMX.Types.pas
FMX.Types3D.pas
FMX.Video.Mac.pas
FMX.Video.pas
FMX.Video.Win.pas

FireMonkey , TApplicationTControl VCL ,


TComponent, VCL .

Windows FireMonkey FireMonkey HD Application(2D) FireMonkey


3D Application,
FireMonkey HD Form FireMonkey 3D Form. fmx .

FireMonkey HD Application :

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs;
type
TForm1 = class(TForm)
Button1: TButton; // TButton FMX.Controls
procedure Button1Click(Sender: TObject);
private
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Hello FireMonkey!'); // ShowMessage FMX.D
ialogs ; ,
end;
end.

Delphi XE2 FireMonkey (2)


FireMonkey (), ;
.

FMX.Objects :

TShape //
TLine
TRectangle
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


TRoundRect
TCalloutRectangle
TEllipse
TCircle
TPie
TArc
TPath
TText
TImage
TPaintBox
TSelection
TSelectionPoint

TRectangle, :

{ TRectangle }
public
constructor Create(AOwner: TComponent); override;
published
property Fill;
property Stroke;
property StrokeCap;
property StrokeDash;
property StrokeJoin;
property StrokeThickness;
property XRadius: Single read FXRadius write SetXRadius;
property YRadius: Single read FYRadius write SetYRadius;
property Corners: TCorners read FCorners write SetCorners stored
IsCornersStored;
property CornerType: TCornerType read FCornerType write SetCorne
rType default TCornerType.ctRound;
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


property Sides: TSides read FSides write SetSides stored IsSides
Stored;

{ TRectangle TShape }
protected
procedure FillChanged(Sender: TObject); virtual;
procedure StrokeChanged(Sender: TObject); virtual;
function GetShapeRect: TRectF;
procedure Painting; override;
procedure AfterPaint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Fill: TBrush read FFill write SetFill;
property Stroke: TBrush read FStroke write SetStroke;
property StrokeThickness: Single read FStrokeThickness write Set
StrokeThickness stored IsStrokeThicknessStored;
property StrokeCap: TStrokeCap read FStrokeCap write SetStrokeCa
p default TStrokeCap.scFlat;
property StrokeDash: TStrokeDash read FStrokeDash write SetStrok
eDash default TStrokeDash.sdSolid;
property StrokeJoin: TStrokeJoin read FStrokeJoin write SetStrok
eJoin default TStrokeJoin.sjMiter;
property ShapeRect: TRectF read GetShapeRect;

{ TShape TControl( FMX.Types) }


public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AddObject(AObject: TFmxObject); override;
procedure RemoveObject(AObject: TFmxObject); override;
procedure SetNewScene(AScene: IScene); virtual;
procedure SetBounds(X, Y, AWidth, AHeight: Single); virtual;
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


{ matrix }
function AbsoluteToLocal(P: TPointF): TPointF; virtual;
function LocalToAbsolute(P: TPointF): TPointF; virtual;
function AbsoluteToLocalVector(P: TVector): TVector; virtual;
function LocalToAbsoluteVector(P: TVector): TVector; virtual;
function PointInObject(X, Y: Single): Boolean; virtual;
{ optimizations }
procedure RecalcUpdateRect; virtual;
procedure RecalcNeedAlign; virtual;
procedure RecalcOpacity; virtual;
procedure RecalcAbsolute; virtual;
procedure RecalcEnabled; virtual;
procedure RecalcHasEffect; virtual;
{ drag and drop }
function MakeScreenshot: TBitmap;
{ caret }
procedure ShowCaretProc;
procedure SetCaretPos(const APoint: TPointF);
procedure SetCaretSize(const ASize: TPointF);
procedure SetCaretColor(const AColor: TAlphaColor);
procedure HideCaret;
{ align }
procedure BeginUpdate; virtual;
procedure EndUpdate; virtual;
procedure Realign; virtual;
{ paining }
procedure ApplyEffect;
procedure Painting; virtual;
procedure DoPaint; virtual;
procedure AfterPaint; virtual;
{ effects }
procedure UpdateEffects;
{ }
procedure SetFocus;
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


procedure PaintTo(const ACanvas: TCanvas; const ARect: TRectF; c
onst AParent: TFmxObject = nil);
procedure Repaint;
procedure InvalidateRect(ARect: TRectF);
procedure Lock;
property AbsoluteMatrix: TMatrix read GetAbsoluteMatrix;
property AbsoluteOpacity: Single read GetAbsoluteOpacity;
property AbsoluteWidth: Single read GetAbsoluteWidth;
property AbsoluteHeight: Single read GetAbsoluteHeight;
property AbsoluteScale: TPointF read GetAbsoluteScale;
property AbsoluteEnabled: Boolean read GetAbsoluteEnabled;
property HasEffect: Boolean read GetAbsoluteHasEffect;
property HasDisablePaintEffect: Boolean read GetAbsoluteHasDisa
blePaintEffect;
property HasAfterPaintEffect: Boolean read GetAbsoluteHasAfterP
aintEffect;
property ChildrenRect: TRectF read GetChildrenRect;
property InvertAbsoluteMatrix: TMatrix read GetInvertAbsoluteMa
trix;
property InPaintTo: Boolean read FInPaintTo;
property LocalRect: TRectF read GetLocalRect;
property AbsoluteRect: TRectF read GetAbsoluteRect;
property UpdateRect: TRectF read GetUpdateRect;
property BoundsRect: TRectF read GetBoundsRect write SetBoundsRe
ct;
property ParentedRect: TRectF read GetParentedRect;
property ParentedVisible: Boolean read GetParentedVisible;
property ClipRect: TRectF read GetClipRect;
property Canvas: TCanvas read GetCanvas;
property Scene: IScene read FScene;
property AutoCapture: Boolean read FAutoCapture write FAutoCaptu
re default False;
property CanFocus: Boolean read FCanFocus write FCanFocus defaul
t False;
www.DelphiXEbbs.com

Delphi XE2 FireMonkey


property DisableFocusEffect: Boolean read FDisableFocusEffect wr
ite FDisableFocusEffect default False;
property DisableDefaultAlign: Boolean read FDisableDefaultAlign
write FDisableDefaultAlign;
property TabOrder: TTabOrder read GetTabOrder write SetTabOrder
default -1;
published
{ triggers }
property IsMouseOver: Boolean read FIsMouseOver;
property IsDragOver: Boolean read FIsDragOver;
property IsFocused: Boolean read FIsFocused;
property IsVisible: Boolean read FVisible;
{ props }
property Align: TAlignLayout read FAlign write SetAlign default
TAlignLayout.alNone;
property Cursor: TCursor read GetCursor write SetCursor default
crDefault;
property DragMode: TDragMode read GetDragMode write SetDragMode
default TDragMode.dmManual;
property EnableDragHighlight: Boolean read FEnableDragHighlight
write FEnableDragHighlight default True;
property Enabled: Boolean read FEnabled write SetEnabled default
True;
property Position: TPosition read FPosition write SetPosition;
property RotationAngle: Single read FRotationAngle write SetRota
tionAngle;
property RotationCenter: TPosition read FRotationCenter write FR
otationCenter;
property Locked: Boolean read FLocked write SetLocked default Fa
lse;
property Width: Single read FWidth write SetWidth;
property Height: Single read FHeight write SetHeight;
property Margins: TBounds read FMargins write FMargins;
property Padding: TBounds read FPadding write FPadding;
www.DelphiXEbbs.com

10

Delphi XE2 FireMonkey


property Opacity: Single read FOpacity write SetOpacity stored I
sOpacityStored;
property ClipChildren: Boolean read FClipChildren write SetClipC
hildren default False;
property ClipParent: Boolean read FClipParent write FClipParent
default False;
property HitTest: Boolean read FHitTest write SetHitTest default
True;
property CanClip: Boolean read FCanClip write FCanClip default T
rue;
property PopupMenu: TCustomPopupMenu read FPopupMenu write SetPo
pupMenu;
property Scale: TPosition read FScale write FScale;
property Visible: Boolean read FVisible write SetVisible default
True;
property DesignVisible: Boolean read FDesignVisible write SetDes
ignVisible default True;
property OnDragEnter: TDragEnterEvent read FOnDragEnter write FO
nDragEnter;
property OnDragLeave: TNotifyEvent read FOnDragLeave write FOnDr
agLeave;
property OnDragOver: TDragOverEvent read FOnDragOver write FOnDr
agOver;
property OnDragDrop: TDragDropEvent read FOnDragDrop write FOnDr
agDrop;
property OnDragEnd: TNotifyEvent read FOnDragEnd write FOnDragEn
d;
property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown;
property OnKeyUp: TKeyEvent read FOnKeyUp write FOnKeyUp;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblC
lick;
property OnCanFocus: TCanFocusEvent read FOnCanFocus write FOnCa
nFocus;
www.DelphiXEbbs.com

11

Delphi XE2 FireMonkey


property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
property OnExit: TNotifyEvent read FOnExit write FOnExit;
property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMou
seDown;
property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FO
nMouseMove;
property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseU
p;
property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write
FOnMouseWheel;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOn
MouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOn
MouseLeave;
property OnPainting: TOnPaintEvent read FOnPainting write FOnPai
nting;
property OnPaint: TOnPaintEvent read FOnPaint write FOnPaint;
property OnResize: TNotifyEvent read FOnResize write FOnResize;
property OnApplyStyleLookup: TNotifyEvent read FOnApplyStyleLoo
kup write FOnApplyStyleLookup;

{ TControl TFmxObject ( FMX.Types) }


public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Release(Delay: Single = 0.1);
{ check for support interface }
function IsIControl: Boolean;
function AsIControl: IControl;
procedure SetRoot(ARoot: IRoot);
{ design }
procedure SetDesign(Value: Boolean; SetChildren: Boolean = Tru
e);
function ItemClass: string; virtual;
www.DelphiXEbbs.com

12

Delphi XE2 FireMonkey


{ clone }
function Clone(const AOwner: TComponent): TFmxObject;
procedure CloneChildFromStream(AStream: TStream);
{ childs }
procedure AddObject(AObject: TFmxObject); virtual;
procedure InsertObject(Index: Integer; AObject: TFmxObject); vir
tual;
procedure RemoveObject(AObject: TFmxObject); overload; virtual;
procedure RemoveObject(Index: Integer); overload; virtual;
procedure Exchange(AObject1, AObject2: TFmxObject); virtual;
procedure DeleteChildren; virtual;
procedure BringToFront;
procedure SendToBack;
procedure AddObjectsToList(const AList: TList);
procedure AddControlsToList(const AList: TList);
procedure Sort(Compare: TFmxObjectSortCompare); virtual;
{ notify }
procedure AddFreeNotify(const AObject: IFreeNotification);
procedure RemoveFreeNotify(const AObject: IFreeNotification);
{ tab }
procedure GetTabOrderList(const List: TList; AChildren: Boolea
n);
{ i/o }
procedure LoadFromStream(const AStream: TStream);
procedure SaveToStream(const Stream: TStream);
procedure LoadFromBinStream(const AStream: TStream);
procedure SaveToBinStream(const AStream: TStream);
{ resource }
function FindStyleResource(const AStyleLookup: string): TFmxObj
ect; virtual;
procedure UpdateStyle; virtual;
{ animations }
procedure StartAnimation(const AName: string); virtual;
procedure StopAnimation(const AName: string); virtual;
www.DelphiXEbbs.com

13

Delphi XE2 FireMonkey


procedure StartTriggerAnimation(AInstance: TFmxObject; const AT
rigger: string); virtual;
procedure StartTriggerAnimationWait(AInstance: TFmxObject; cons
t ATrigger: string); virtual;
procedure StopTriggerAnimation(AInstance: TFmxObject); virtual;
procedure ApplyTriggerEffect(AInstance: TFmxObject; const ATrig
ger: string); virtual;
{ animation property }
procedure AnimateFloat(const APropertyName: string; const NewVal
ue: Single; Duration: ...);
procedure AnimateColor(const APropertyName: string; NewValue: TA
lphaColor; Duration: ...);
procedure AnimateFloatDelay(const APropertyName: string; const N
ewValue: Single; Duration: ...);
procedure AnimateFloatWait(const APropertyName: string; const Ne
wValue: Single; Duration: ...);
procedure StopPropertyAnimation(const APropertyName: string);
{ }
property Root: IRoot read FRoot;
property Stored: Boolean read FStored write SetStored;
{ }
property TagObject: TObject read FTagObject write FTagObject;
property TagFloat: Single read FTagFloat write FTagFloat;
property TagString: string read FTagString write FTagString;
{ children }
property ChildrenCount: Integer read GetChildrenCount;
property Children[Index: Integer]: TFmxObject read GetChild;
{ binding }
function FindBinding(const ABinding: string): TFmxObject;
property Data: Variant read GetData write SetData;
property Binding[const Index: string]: Variant read GetBinding w
rite SetBinding;
property Parent: TFmxObject read FParent write SetParent;
property Index: Integer read GetIndex write SetIndex;
www.DelphiXEbbs.com

14

Delphi XE2 FireMonkey


published
property BindingName: string read FBindingName write SetBindingN
ame;
property StyleName: string read FStyleName write SetStyleName;

{ TFmxObject TComponent ( System.Classes), }


public
constructor Create(AOwner: TComponent); virtual;
destructor Destroy; override;
procedure BeforeDestruction; override;
procedure DestroyComponents;
procedure Destroying;
function ExecuteAction(Action: TBasicAction): Boolean; dynamic;
function FindComponent(const AName: string): TComponent;
procedure FreeNotification(AComponent: TComponent);
procedure RemoveFreeNotification(AComponent: TComponent);
procedure FreeOnRelease;
function GetEnumerator: TComponentEnumerator;
function GetParentComponent: TComponent; dynamic;
function GetNamePath: string; override;
function HasParent: Boolean; dynamic;
procedure InsertComponent(AComponent: TComponent);
procedure RemoveComponent(AComponent: TComponent);
procedure SetSubComponent(IsSubComponent: Boolean);
function SafeCallException(ExceptObject: TObject; ExceptAddr: P
ointer): HResult; override;
function UpdateAction(Action: TBasicAction): Boolean; virtual;
function IsImplementorOf(const I: IInterface): Boolean;
function ReferenceInterface(const I: IInterface; Operation: TOpe
ration): Boolean;
property ComObject: IUnknown read GetComObject;
property Components[Index: Integer]: TComponent read GetComponen
t;
property ComponentCount: Integer read GetComponentCount;
www.DelphiXEbbs.com

15

Delphi XE2 FireMonkey


property ComponentIndex: Integer read GetComponentIndex write Se
tComponentIndex;
property ComponentState: TComponentState read FComponentState;
property ComponentStyle: TComponentStyle read FComponentStyle;
property DesignInfo: Longint read FDesignInfo write FDesignInfo;
property Owner: TComponent read FOwner;
property VCLComObject: Pointer read FVCLComObject write FVCLComO
bject;
property Observers: TObservers read GetObservers;
published
property Name: TComponentName read FName write SetName stored Fa
lse;
property Tag: NativeInt read FTag write FTag default 0;

{ TComponent TPersistent ( System.Classes) }


public
destructor Destroy; override;
procedure Assign(Source: TPersistent); virtual;
function GetNamePath: string; dynamic;

{ TPersistent TObject ( System) }


public
constructor Create;
procedure Free;
class function InitInstance(Instance: Pointer): TObject;
procedure CleanupInstance;
function ClassType: TClass; inline;
class function ClassName: string;
class function ClassNameIs(const Name: string): Boolean;
class function ClassParent: TClass;
class function ClassInfo: Pointer; inline;
class function InstanceSize: Longint; inline;
class function InheritsFrom(AClass: TClass): Boolean;
www.DelphiXEbbs.com

16

Delphi XE2 FireMonkey


class function MethodAddress(const Name: ShortString): Pointer;
overload;
class function MethodAddress(const Name: string): Pointer; overl
oad;
class function MethodName(Address: Pointer): string;
class function QualifiedClassName: string;
function FieldAddress(const Name: ShortString): Pointer; overloa
d;
function FieldAddress(const Name: string): Pointer; overload;
function GetInterface(const IID: TGUID; out Obj): Boolean;
class function GetInterfaceEntry(const IID: TGUID): PInterfaceEn
try;
class function GetInterfaceTable: PInterfaceTable;
class function UnitName: string;
class function UnitScope: string;
function Equals(Obj: TObject): Boolean; virtual;
function GetHashCode: Integer; virtual;
function ToString: string; virtual;
function SafeCallException(ExceptObject: TObject; ExceptAddr: P
ointer): HResult; virtual;
procedure AfterConstruction; virtual;
procedure BeforeDestruction; virtual;
procedure Dispatch(var Message); virtual;
procedure DefaultHandler(var Message); virtual;
class function NewInstance: TObject; virtual;
procedure FreeInstance; virtual;
destructor Destroy; virtual;

Delphi XE2 FireMonkey (3) - TPosition


FireMonkey FM . FM LeftTop , .

www.DelphiXEbbs.com

17

Delphi XE2 FireMonkey

//FM LeftTop, Position


procedure TForm1.Button1Click(Sender: TObject);
begin
Rectangle1.Position.X := Rectangle1.Position.X + 10;
Rectangle1.Position.Y := Rectangle1.Position.Y + 10;
end;

//TPosition
procedure TForm1.Button2Click(Sender: TObject);
var
posObj: TPosition;
begin
posObj := TPosition.Create(TPointF.Create(10, 10));
Rectangle1.Position.Assign(posObj);
posObj.Free;
end;

//TPosition.Point TPointF
procedure TForm1.Button3Click(Sender: TObject);
begin
Rectangle1.Position.Point := TPointF.Create(50, 50);
end;

//TPointF
procedure TForm1.Button4Click(Sender: TObject);
var
ptf: TPointF;
begin
ptf.X := ClientWidth / 2;
ptf.Y := ClientHeight / 2;
ptf.Offset(-Rectangle1.Width / 2, -Rectangle1.Height / 2);
www.DelphiXEbbs.com

18

Delphi XE2 FireMonkey


Rectangle1.Position.Point := ptf;
end;

//TVector , TPosition
procedure TForm1.Button5Click(Sender: TObject);
var
vector: TVector;
begin
vector.X := ClientWidth - Rectangle1.Width;
vector.Y := ClientHeight - Rectangle1.Height;
//

vector.W := 0.0;

Rectangle1.Position.Vector := vector;
end;

Delphi XE2 FireMonkey (4) -


1 FM(HD) , TLine( Line1);
2 Line1 Button1;
3 Button2

, Button1.Parent Line1; Button2.Parent .

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Objects;
www.DelphiXEbbs.com

19

Delphi XE2 FireMonkey


type
TForm1 = class(TForm)
Line1: TLine;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
Button2.OnClick := Button1.OnClick; { TLine }
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Caption := TButton(Sender).Parent.ClassName; { TForm1;
Text }
Line1.Position.X := Line1.Position.X + 10;

{ Btuuon1 }

end;
end.

www.DelphiXEbbs.com

20

Delphi XE2 FireMonkey

Delphi XE2 FireMonkey (5) - TAlphaColor


TColor, TAlphaColor .

TAlphaColor = type Cardinal; .

: AA RR GG BB(); TColor , .

HD TRectangle TButton, :

//
procedure TForm1.Button1Click(Sender: TObject);
begin
Rectangle1.Fill.Color := $FFFF0000;
Rectangle1.Fill.Color := claRed;
Rectangle1.Fill.Color := TAlphaColors.Red;
Rectangle1.Fill.Color := TAlphaColorRec.Red;
end;

// TAlphaColor
procedure TForm1.Button2Click(Sender: TObject);
begin
Rectangle1.Fill.Color := MakeColor(0, 0, 255);
// AppendColor()SubtractColor()
end;

// TAlphaColorRec
procedure TForm1.Button3Click(Sender: TObject);
www.DelphiXEbbs.com

21

Delphi XE2 FireMonkey


var
C: TAlphaColor;
A,R,G,B: Byte;
begin
C := MakeColor($82, $00, $4B, $FF);
Rectangle1.Fill.Color := C;
A := TAlphaColorRec(C).A;
R := TAlphaColorRec(C).R;
G := TAlphaColorRec(C).G;
B := TAlphaColorRec(C).B;
ShowMessageFmt('%x %x %x %x', [A, R, G, B]);

TAlphaColorRec(C).A := 127; //
Rectangle1.Fill.Color := C;
A := TAlphaColorRec(C).A;
ShowMessageFmt('%x %x %x %x', [A, R, G, B]);
end;

, : .

TRectangleTColorComboBoxTColorPanelTColorPickerTComboColorBoxTColor
Quad , :

// TColorComboBox OnChange
procedure TForm1.ColorComboBox1Change(Sender: TObject);
begin
Rectangle1.Fill.Color := ColorComboBox1.Color;
end;

// TColorPanel OnChange
www.DelphiXEbbs.com

22

Delphi XE2 FireMonkey


procedure TForm1.ColorPanel1Change(Sender: TObject);
begin
Rectangle1.Fill.Color := ColorPanel1.Color;
end;

// TColorPicker OnChange
procedure TForm1.ColorPicker1Click(Sender: TObject);
begin
Rectangle1.Fill.Color := ColorPicker1.Color;
end;

// TComboColorBox OnChange
procedure TForm1.ComboColorBox1Change(Sender: TObject);
begin
Rectangle1.Fill.Color := ComboColorBox1.Color;
end;

// TColorQuad HSL()
procedure TForm1.ColorQuad1Change(Sender: TObject);
var
C: TAlphaColor;
begin
C := Rectangle1.Fill.Color;
Rectangle1.Fill.Color := ChangeHSL(C, ColorQuad1.Hue, ColorQuad1.
Sat, ColorQuad1.Lum);
Caption := Format('%f, %f, %f', [ColorQuad1.Hue, ColorQuad1.Sat, C
olorQuad1.Lum]);
end;

System.UIConsts StringToAlphaColor()AlphaCo lorToIdent()IdentToAlphaCo


lor() .

www.DelphiXEbbs.com

23

Delphi XE2 FireMonkey

Delphi XE2 FireMonkey (6) - TLine TEllipse TCircle TPie TArc


TRectangleTRoundRectTCalloutRectangle
TShape , :

Fill

: TBrush;

//

Stroke

: TBrush;

//()

StrokeThickness : Single;

//()

StrokeCap

: TStrokeCap;

//, TStrokeCap ()

StrokeDash

: TStrokeDash; //, TStrokeDash()

StrokeJoin

: TStrokeJoin; //, TStrokeJoin()

ShapeRect

: TRectF;

//()

TLine Fill, LineType (TLineType );

procedure TForm1.Button1Click(Sender: TObject);


begin
Line1.LineType := TLineType.ltDiagonal; //
Line2.LineType := TLineType.ltTop;

//

Line3.LineType := TLineType.ltLeft;

//

end;

TElipse TCircle , StrokeCapStrokeJoin.

procedure TForm1.Button1Click(Sender: TObject);


www.DelphiXEbbs.com

24

Delphi XE2 FireMonkey


begin
Ellipse1.StrokeDash := TStrokeDash.sdDot; //
Circle1.Fill.Kind := TBrushKind.bkNone;

//

end;

TArc TPie StartAngleEndAngle .

TRectangle XRadiusYRadius Sides C


ornersCornerType ;

TRoundRect Corners ; TRectangle TRound


Rect.

procedure TForm1.Button1Click(Sender: TObject);


begin
Rectangle1.Position.X := 50;
Rectangle1.Position.Y := 10;
Rectangle1.Width := 100;
Rectangle1.Height := 120;
Rectangle1.StrokeThickness := 16;
Rectangle1.Fill.Color := $80FF0000;
Rectangle1.Stroke.Color := $800000FF;
Rectangle1.XRadius := 8;
Rectangle1.YRadius := 8;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
www.DelphiXEbbs.com

25

Delphi XE2 FireMonkey


Rectangle2.Position.X := 350;
Rectangle2.Position.Y := 10;
Rectangle2.Width := 100;
Rectangle2.Height := 120;
Rectangle2.StrokeThickness := 4;
Rectangle2.Fill.Color := claRed;
Rectangle2.Stroke.Color := claBlack;
Rectangle2.CornerType := TCornerType.ctBevel;
Rectangle2.Corners := [TCorner.crBottomLeft, TCorner.crBottomRigh
t];
Rectangle2.Sides := [TSide.sdBottom, TSide.sdRight];

// Corners Sides : AllCornersAllSides


end;

TCalloutRectangle , , .

CalloutWidthCalloutLengthCalloutPositionCalloutOffset
.

procedure TForm1.Button1Click(Sender: TObject);


begin
CalloutRectangle1.Width := 200;
CalloutRectangle1.Height := 150;
CalloutRectangle1.CalloutPosition := TCalloutPosition.cpBottom;
CalloutRectangle1.CalloutWidth := CalloutRectangle1.Width / 4;
CalloutRectangle1.CalloutLength := CalloutRectangle1.Height / 2;
CalloutRectangle1.CalloutOffset := -CalloutRectangle1.Width / 2;
end;

www.DelphiXEbbs.com

26

Delphi XE2 FireMonkey


FillStroke , TBrush , TBitmapTBitma
pObjectTCanvas .

Delphi XE2 FireMonkey (7) - TText TFont


TText TShape(TControl -> TShape);

TLabel TControl -> TStyledControl -> TTextControl -> TLabel.

TText :

{ }
Text

: string;

//

Font

: TFont;

//

Fill

: TBrush;

//

HorzTextAlign : TTextAlign; //
VertTextAlign : TTextAlign; //
AutoSize

: Boolean;

//

Stretch

: Boolean;

//

WordWrap

: Boolean;

//

{ }
Realign; //

www.DelphiXEbbs.com

27

Delphi XE2 FireMonkey


TFont( FMX.Types) :

{ }
Family : TFontName;

//

Size

: Single;

//

Style

: TFontStyles; //

procedure TForm1.FormCreate(Sender: TObject);


begin
Text1.Align := TAlignLayout.alClient;
Text1.Text := ' Delphi XE2 ';

Text1.Font.Family := '';
Text1.Font.Size := 32;
Text1.Font.Style := [TFontStyle.fsBold, TFontStyle.fsUnderline];
Text1.Fill.Color := claRed;
Text1.Stretch := True;
end;

Delphi XE2 FireMonkey (8) - TImage


TImage :

{ }

www.DelphiXEbbs.com

28

Delphi XE2 FireMonkey


Bitmap
BitmapMargins
WrapMode

: TBitmap;
: TBounds;

//
//

: TImageWrapMode; //; iwOriginaliwFitiwSt

retchiwTile()
DisableInterpolation : Boolean;

//()

TImageViewerTImageControl TImage .

TImageViewer TScrollBox, ;

TImageControl TStyledControl, .

TImageTImageV iewerTImageControlTOpenDialog TButton :

//Bitmap
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName);
ImageControl1.Bitmap.LoadFromFile(OpenDialog1.FileName);
ImageViewer1.Bitmap.LoadFromFile(OpenDialog1.FileName);
end;
end;

//WrapMode
procedure TForm1.Button2Click(Sender: TObject);
begin
www.DelphiXEbbs.com

29

Delphi XE2 FireMonkey


Image1.WrapMode := TImageWrapMode(Tag); //iwOriginal, iwFit, iwSt
retch, iwTile
Tag := Tag + 1;
if Tag = 4 then Tag := 0;
end;

//BitmapMargins
procedure TForm1.Button3Click(Sender: TObject);
begin
with Image1.BitmapMargins do
begin
Left := Left + 10;
end;
Image1.Bitmap.BitmapChanged; //
end;

//DisableInterpolation
procedure TForm1.Button4Click(Sender: TObject);
begin
Image1.DisableInterpolation := not Image1.DisableInterpolation;
Image1.Bitmap.BitmapChanged;
end;

Delphi XE2 FireMonkey (9) - TBitmap


TBitmap :

{ }

www.DelphiXEbbs.com

30

Delphi XE2 FireMonkey


SetSize();

//

Clear();

//,

ClearRect();

//,

BitmapChanged();

//

IsEmpty();

//

UpdateHandles();

// Handles

AddFreeNotify();

//;

Handles
RemoveFreeNotify();

//; Handles

Rotate();

//

FlipHorizontal();

//

FlipVertical();

//

InvertAlpha();

//,

FillColor();

//,

CreateMask();

//; TBitmap

,
ApplyMask();

//, CreateMask()

CreateThumbnail();

//

LoadFromFile();

//

LoadFromStream();

//

LoadThumbnailFromFile(); //
SaveToFile();
www.DelphiXEbbs.com

//
31

Delphi XE2 FireMonkey


SaveToStream();

//

HandleRemove();

// Handles ,

HandleAdd();

// Handles

HandleExists();

// Handles

{ }
Width

: Integer;

//

Height

: Integer;

//

Handles[AItem: Pointer]

: Pointer;

// Handles

, ; HandleAdd();
HandlesNeedUpdate[AItem: Pointer] : Boolean;

// Handles

Canvas
Pixels[X, Y: Integer]

: TCanvas;
: TAlphaColor;

//
//

ScanLine[Y: Integer]

: PAlphaColorArray; //

StartLine

: PAlphaColorArray; //

ResourceBitmap

: TBitmap;

//

StyleLookup

: string;

//

, TBitmap

{ }
www.DelphiXEbbs.com

32

Delphi XE2 FireMonkey


OnChange: TNotifyEvent; //

Create()SetSize()Clear()IsEmpty():

procedure TForm1.Button1Click(Sender: TObject);


var
bit: TBitmap;
begin
bit := TBitmap.Create(0, 0);
ShowMessage(BoolToStr(bit.IsEmpty, True));
bit.SetSize(100, 100);
ShowMessage(BoolToStr(bit.IsEmpty, True));
bit.Clear(claRed);
Image1.Bitmap.Assign(bit);
bit.Free;
end;

Rotate()FlipHorizontal()FlipVertical():

procedure TForm1.FormCreate(Sender: TObject);


begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName);
Image1.WrapMode := TImageWrapMode.iwFit;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
www.DelphiXEbbs.com

33

Delphi XE2 FireMonkey


ShowMessage('Rotate');
Image1.Bitmap.Rotate(60);
ShowMessage('FlipHorizontal');
Image1.Bitmap.FlipHorizontal;
ShowMessage('FlipVertical');
Image1.Bitmap.FlipVertical;
end;

FillColor():

procedure TForm1.FormCreate(Sender: TObject);


begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName); //
Image1.WrapMode := TImageWrapMode.iwFit;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Bitmap.FillColor($800000FF);
//

Image1.Bitmap.FillColor($FF0000FF);

end;

CreateMask()ApplyMask():

procedure TForm1.FormCreate(Sender: TObject);


www.DelphiXEbbs.com

34

Delphi XE2 FireMonkey


begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName); //
Image1.WrapMode := TImageWrapMode.iwFit;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
bit: TBitmap;
bitAs: PByteArray;
begin
bit := TBitmap.Create(0, 0);
bit.Assign(Image1.Bitmap); // Image1 TBitmap

bitAs := bit.CreateMask;
Image1.Bitmap.Clear(claBlue);
Image1.Bitmap.ApplyMask(bitAs);
bit.Free;
end;

StartLine: , , .

procedure TForm1.FormCreate(Sender: TObject);


begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName); //
Image1.WrapMode := TImageWrapMode.iwFit;
www.DelphiXEbbs.com

35

Delphi XE2 FireMonkey


end;
end;

//
procedure TForm1.Button1Click(Sender: TObject);
var
bit: TBitmap;
bts: PAlphaColorArray;
i: Integer;
j: Integer;
begin
bit := TBitmap.Create(0, 0);
bit.Assign(Image1.Bitmap);
bts := bit.StartLine;
for i := 0 to bit.Width - 1 do
for j := 0 to bit.Height - 1 do
TAlphaColorRec(bts[i*j]).A := TAlphaColorRec(bts[i*j]).A div 2;
//,

Image1.Bitmap.Assign(bit);
bit.Free;
end;

Pixels[X, Y: Integer]:

procedure TForm1.FormCreate(Sender: TObject);


begin
if OpenDialog1.Execute then
begin
Image1.Bitmap.LoadFromFile(OpenDialog1.FileName); //
www.DelphiXEbbs.com

36

Delphi XE2 FireMonkey


Image1.WrapMode := TImageWrapMode.iwFit;
Image1.Position.X := 0;
Image1.Position.Y := 0;
Image1.Width := Image1.Bitmap.Width;
Image1.Height := Image1.Bitmap.Height;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
bit: TBitmap;
W,H,i,j: Integer;
R: TRectF;
begin
W := Trunc(Image1.Width);
H := Trunc(Image1.Height);
bit := TBitmap.Create(W div 2, H div 2);
for i := 0 to W - 1 do
for j := 0 to H - 1 do
begin
if Odd(i) and Odd(j) then //
bit.Pixels[i div 2, j div 2] := Image1.Bitmap.Pixels[i, j];
end;
Image1.Width := bit.Width;
Image1.Height := bit.Height;
Image1.Bitmap.Assign(bit);
Realign;
bit.Free;
end;

Handles : TBitmap , .

www.DelphiXEbbs.com

37

Delphi XE2 FireMonkey


var
bit1,bit2,bit3: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
begin
bit1 := TBitmap.Create(100, 100);
bit2 := TBitmap.Create(100, 100);
bit3 := TBitmap.Create(100, 100);
bit1.Clear(claRed);
bit2.Clear(claGreen);
bit3.Clear(claBlue);
Image1.Width := 100;
Image1.Height := 100;
Image1.Bitmap.HandleAdd(Button1);
Image1.Bitmap.Handles[Button1] := bit1;
Image1.Bitmap.HandleAdd(Button2);
Image1.Bitmap.Handles[Button2] := bit2;
Image1.Bitmap.HandleAdd(Button3);
Image1.Bitmap.Handles[Button3] := bit3;
Button2.OnClick := Button1.OnClick;
Button3.OnClick := Button1.OnClick;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Bitmap := Image1.Bitmap.Handles[Sender];
end;

www.DelphiXEbbs.com

38

Delphi XE2 FireMonkey


FMX.Types GetMeasureBitmap() 1*1 TBitmap .

Delphi XE2 FireMonkey (10) - TPointTPointFTSmallPoint


TSizeTRectTRectF
, TPointFTRectF , ; ;
.

System.Types , FM .

TPoint:

Create();

//

{}
Equal;

// =

NotEqual;

// <>

Add;

// +

Subtract;

// -

Implicit;

// TSmallPoint TPoint

Explicit;

// TSmallPoint

{}
Distance();

//

SetLocation(); //
Offset();

//

Add();

//

www.DelphiXEbbs.com

39

Delphi XE2 FireMonkey


Subtract();

//

IsZero();

// [0,0]

{}
X,Y: Longint;

{ }
procedure TForm1.Button1Click(Sender: TObject);
var
p1,p2,p3: TPoint;
begin
p1 := TPoint.Create(11, 22);
p2.Create(11, 11);
p3 := p1 + p2;
ShowMessageFmt('%d,%d', [p3.X, p3.Y]); //22,33
p3.SetLocation(0, 0);
p3 := p1.Add(p2);
ShowMessageFmt('%d,%d', [p3.X, p3.Y]); //22,33
end;

TPointF: TPoint :

Ceiling();

//

Truncate(); //
Round();

//

procedure TForm1.Button1Click(Sender: TObject);


var
pf: TPointF;
p1,p2,p3: TPoint;
begin
www.DelphiXEbbs.com

40

Delphi XE2 FireMonkey


pf.Create(1.4, 1.6);
p1 := pf.Ceiling;
p2 := pf.Truncate;
p3 := pf.Round;
ShowMessageFmt('%d,%d
X, p3.Y]); //2,2

1,1

%d,%d

%d,%d', [p1.X, p1.Y, p2.X, p2.Y, p3.

1,2

end;

TSmallPoint: , .

Create();

//

{}
Equal;

// =

NotEqual;

// <>

Add;

// +

Subtract;

// -

{}
Add();

//

Subtract(); //
Distance(); //
IsZero();

// [0,0]

{}
X,Y: SmallInt;

TSize:

Create();

//

{}
www.DelphiXEbbs.com

41

Delphi XE2 FireMonkey


Equal;

// =

NotEqual;

// <>

Add;

// +

Subtract;

// -

{}
Add();

//

Subtract(); //
Distance(); //
IsZero();

// [0,0]

{}
Width;

//

Height;

//

{}
cx,cy: Single;

TRect:

Create();

//; NormalizeRect()

{}
Equal;

// =

NotEqual;

// <>

Add;

// + ()

Multiply;

// * ()

{}
Empty;

// TRect ;

Intersect;

//

www.DelphiXEbbs.com

42

Delphi XE2 FireMonkey


Union;

//

{}
NormalizeRect();

//; Top > Bottom Left > Right ,

.
IsEmpty();

//

Contains();

//

IntersectsWith(); //
Intersect();

//

Union();

//

Offset();

//

SetLocation();

//

Inflate();

//()

CenterPoint();

//

SplitRect();

//, TSplitRectType (LeftTopRightBottom)

{}
Width: Integer;

//

Height: Integer;

//

Size: TSize;

//

Location: TPoint; //
{, }
(Left, Top, Right, Bottom: Longint) (TopLeft, BottomRight: TPoin
t)

www.DelphiXEbbs.com

43

Delphi XE2 FireMonkey


TRectF: TRect TRect .

Ceiling();

//

Truncate(); //
Round();

//

{ function }
EqualRect();

// TRect TRectF

Rect();

// TRect

RectF();

// TRectF

NormalizeRectF(); // TPointF TRectF


NormalizeRect();

// TRectF

RectWidth();

//

RectHeight();

//

RectCenter();

//

Bounds();

//

Point();

// TPoint

PointF();

// TPointF

MinPoint();

//( Y)

ScalePoint();

//

SmallPoint();

// TSmallPoint

PtInRect();

//

www.DelphiXEbbs.com

44

Delphi XE2 FireMonkey


PtInCircle();

//

IntersectRect();

//

UnionRect();

//

IsRectEmpty();

//

OffsetRect();

//

CenterPoint();

//

SplitRect();

//

CenteredRect();

//;

IntersectRectF(); //
UnionRectF();

//

{ procedure }
MultiplyRect();

//

InflateRect();

//

Delphi XE2 FireMonkey (11) -


RotationAngleRotationCenterOpacity TControl(FMX.Types),
.

HD TRectangle ...

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.Width := 100;
www.DelphiXEbbs.com

45

Delphi XE2 FireMonkey


Rectangle1.Height := 100;
Rectangle1.Fill.Color := claYellow;
Rectangle1.Stroke.Color := claRed;
{; }
Rectangle1.Align := TAlignLayout.alCenter;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
{: [0.5,0.5] , ; [0,0] [1,1]
}
Rectangle1.RotationCenter.X := 0.5;
Rectangle1.RotationCenter.Y := 0.5; //
{}
Rectangle1.RotationAngle := 45;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
{: 0.0 - 1.0}
Rectangle1.Opacity := 0.5;
end;

Delphi XE2 FireMonkey (12) - ()


HD TAniIndicator, Enabled True, .

, :

www.DelphiXEbbs.com

46

Delphi XE2 FireMonkey


Enabled: Boolean;

//

Style: TAniIndicatorStyle; //TAniIndicatorStyle = (aiLinear, aiCirc


ular);

{}
AniIndicator1.Style := TAniIndicatorStyle.aiCircular;

? , FAni: TFloatAnimation; .
TFloatAnimat ion TAnimation; TAnimation FMX.Types ,
.

TAnimation FMX.Ani :

TFloatAnimation

//

TFloatKeyAnimation

//

TColorAnimation

//

TColorKeyAnimation

//

TGradientAnimation

//

TPathAnimation

//

TRectAnimation

//

TBitmapAnimation

//

TBitmapListAnimation //
TFloatKeyAnimation

//

TColorKeyAnimation

//

TFmxObject(FMX ):

StartAnimation();

//

StopAnimation();

//

StartTriggerAnimation();

//

StartTriggerAnimationWait(); //
StopTriggerAnimation();
www.DelphiXEbbs.com

//
47

Delphi XE2 FireMonkey


AnimateFloat();

//

AnimateColor();

//

AnimateFloatDelay();

//

AnimateFloatWait();

//

StopPropertyAnimation();

//

FMX.Types ():

InterpolateSingle();

//

InterpolateRotation(); //
InterpolateColor();

//

InterpolateLinear();

//

InterpolateSine();

//

InterpolateQuint();

//

InterpolateQuart();

//

InterpolateQuad();

//

InterpolateExpo();

//

InterpolateElastic();

//

InterpolateCubic();

//

InterpolateCirc();

//

InterpolateBounce();

//

InterpolateBack();

//

, , :

//Bitmap :
Create New TBitmapAnimation
Create New TBitmapListAnimation

//Color :
Create New TColorAnimation
www.DelphiXEbbs.com

48

Delphi XE2 FireMonkey


Create New TColorKeyAnimation

//Gradient :
Create New TGradientAnimation

//WidthHeightXYStrokeThicknessXRadiusYRadiusOpacityRot
ationAngle :
Create New TFloatAnimation
Create New TFloatKeyAnimation

TRectangle, RotationAngle Create New TFloatAnimation (,


Delete),

FloatAnimation1 :

//, :
procedure TForm1.FormCreate(Sender: TObject);
begin
FloatAnimation1.Enabled := True;
FloatAnimation1.Loop := True;
FloatAnimation1.Duration := 2.5;

//()

FloatAnimation1.StartValue := 0;

//

FloatAnimation1.StopValue := 360; //
end;

www.DelphiXEbbs.com

49

Delphi XE2 FireMonkey


1 TRectangle(Rectangle1);
2 Rectangle1 TFloatAnimat ion(FloatAnimation1);
3 FloatAnimation1 PropertyName RotationAngle;
4 FloatAnimation1 .

uses FMX.Objects, FMX.Ani; //,

var
rect: TRectangle;
procedure TForm1.FormCreate(Sender: TObject);
begin
rect := TRectangle.Create(Self);
rect.Parent := Self;
rect.Align := TAlignLayout.alCenter;
with TFloatAnimation.Create(Self) do
begin
Parent := rect;
PropertyName := 'RotationAngle';
Enabled := True;
Loop := True;
Duration := 2.5;
StartValue := 0;
StopValue := 360;
end;
end;

www.DelphiXEbbs.com

50

Delphi XE2 FireMonkey

Delphi XE2 FireMonkey (13) - ()


TAnimation :

protected
function NormalizedTime: Single;

//

procedure ProcessAnimation; virtual;

//

procedure Loaded; override;

//

public
procedure Start; virtual;

//

procedure Stop; virtual;

//

procedure StopAtCurrent; virtual;

//; Pause

OnFinish
procedure StartTrigger(...); virtual; //, Trig
gerTriggerInverse
procedure ProcessTick(...);

//,

ProcessAnimation .
property Running: Boolean ...;

//;

property Pause: Boolean ...;

//

published
property AnimationType: TAnimationType ...;

//;

(Interpolation)
property AutoReverse: Boolean ...;

//(->

->)
www.DelphiXEbbs.com

51

Delphi XE2 FireMonkey


property Enabled: Boolean ...;

//

property Delay: Single ...;

//

property Duration: Single ...;

//();

0.2
property Interpolation: TInterpolationType ...; //;
()
property Inverse: Boolean ...;

//(->

)
property Loop: Boolean ...;
property Trigger: TTrigger ...;

//
//;

()
property TriggerInverse: TTrigger ...;

//

; ()
property OnProcess: TNotifyEvent ...;

//

property OnFinish: TNotifyEvent ...;

//

end;

{ TriggerTriggerInverse : }
'IsMouseOver=true'
'IsMouseOver=false'
'IsFocused=true'
'IsFocused=false'
'IsVisible=true'
'IsVisible=false'
'IsDragOver=true'
www.DelphiXEbbs.com

52

Delphi XE2 FireMonkey


'IsDragOver=false'
'IsOpen=true'
'IsOpen=false'

TFloatAnimation ;
TColorAnimation ;
TGradientAnimation ;
TRectAnimation (PaddingMargins); ():

StartValue

//

StopValue

//

StartFromCurrent //
PropertyName

//; ()

{ PropertyName : }
'Width'
'Heigth'
'StrokeThickness'
'Position.X'
'Position.Y'
'Scale.X'
'Scale.Y'
'RotationCenter.X'
'RotationCenter.Y'
'RotationAngle'
'Opacity'
'Margins.Left'
'Margins.Top'
'Margins.Rigth'
'Margins.Bottom'
www.DelphiXEbbs.com

53

Delphi XE2 FireMonkey


'Padding.Left'
'Padding.Top'
'Padding.Rigth'
'Padding.Bottom'
'Fill.Color'
'Stroke.Color'
'Fill.Gradient'
'Stroke.Gradient'
'Margins'
'Padding'

TFloatKeyAnimationTColorKeyAnimation Keys (
), :

//TKeys , TKey; TKey.ID(

Keys

)TKey.Key()
PropertyName

//

StartFromCurrent //

TBitmapAnimation ; :

StartValue

//

StopValue

//

PropertyName // 'Bitmap'

www.DelphiXEbbs.com

54

Delphi XE2 FireMonkey


TBitmapListAnimation , (Animat ionCount),
; :

AnimationCount

//

AnimationBitmap //
PropertyName

//

TPathAnimation ; :

Path: TPathData; //; TPathData.Data , (


) SVG Path
Rotate: Boolean; //()

: HD TRectangle, TPathAnimation;
:

const
strPath = 'M 3.84500002861023,3.47300004959106 ' +
'C 4.83799982070923,24.6110000610352 26.2040004730225,34.974998
4741211 42.875,30.8320007324219 ' +
'C 69.8730010986328,24.121000289917 82.1620025634766, -9.7609996
7956543 74.6009979248047,-37.4169998168945 ' +
'C 63.992000579834,-76.2160034179688 23.7210006713867,-93.31400
29907227 -9.33600044250488,-80.4909973144531 ' +
'C -52.2709999084473,-63.8380012512207 -70.8339996337891,-8.086
00044250488 -55.2200012207031,37.6059989929199 ' +
'C -35.9000015258789,94.1429977416992 24.3759994506836,118.2809
9822998 73.6240005493164,96.3960037231445 ' +
www.DelphiXEbbs.com

55

Delphi XE2 FireMonkey


'C 132.567993164063,70.2020034790039 157.505996704102,-7.920000
07629395 133.664993286133,-71.5500030517578 ' +
'C 105.81600189209,-145.880996704102 25.3040008544922,-177.1139
98413086 -40.0859985351563,-146.054992675781 ' +
'C -95.6880035400391,-119.646003723145 -129.975997924805,-55.07
50007629395 -127.064002990723,11.4790000915527';
procedure TForm1.FormCreate(Sender: TObject);
begin
PathAnimation1.Path.Data := strPath;
PathAnimation1.Duration := 8;
PathAnimation1.AutoReverse := True;
PathAnimation1.Loop := True;
PathAnimation1.Rotate := True;
PathAnimation1.Enabled := True;
end;

{ , TPath, . }

: , .

, , FMXObject , :

procedure TForm1.Button1Click(Sender: TObject);


begin
Button1.AnimateFloat('Position.X', Button1.Position.X*2, 1.5);
end;

Delphi XE2 FireMonkey (14) - :


www.DelphiXEbbs.com

56

Delphi XE2 FireMonkey


:

FMX.Filter
FMX.FilterCatBlur
FMX.FilterCatGeometry
FMX.FilterCatTransition
FMX_FilterCatColor
FMX_FilterCatColorAdjust
FMX_FilterCatComposite
FMX_FilterCatGenerator
FMX_FilterCatStyle
FMX_FilterCatTiles
FMX.FilterCatDistortion

FM 10 :

Blur

//FMX.FilterCatBlur

Geometry

//FMX.FilterCatGeometry

Transition

//FMX.FilterCatTransition

Color

//FMX_FilterCatColor

Color Adjust //FMX_FilterCatColorAdjust


Composite

//FMX_FilterCatComposite

Generator

//FMX_FilterCatGenerator

Style

//FMX_FilterCatStyle

Tiles

//FMX_FilterCatTiles

Distortion

//FMX.FilterCatDistortion

{ Blur }
www.DelphiXEbbs.com

57

Delphi XE2 FireMonkey


GaussianBlur
BoxBlur
DirectionalBlur
RadialBlur
{ Geometry }
AffineTransform
PerspectiveTransform
Crop
{ Transition }
BandedSwirlTransition
lindTransition
loodTransition
ircleTransition
agnifyTransition
rumpleTransition
issolveTransition
ropTransition
adeTransition
rightTransition
ixelateTransition
lurTransition
iggleTransition
hapeTransition
ippleTransition
otateCrumpleTransition
aturateTransition
lideTransition
wirlTransition
aterTransition
aveTransition
ineTransition
{ Color }
Invert
onochrome
www.DelphiXEbbs.com

58

Delphi XE2 FireMonkey


olorKeyAlpha
askToAlpha
{ Color Adjust }
HueAdjust
ontrast
loom
loom
{ Composite }
NormalBlend
{ Generator }
Fill
illRGB
{ Style }
Pixelate
mboss
harpen
oon
epia
aperSketch
encilStroke
{ Tiles }
Tiler
{ Distortion }
Ripple
wirl
agnify
moothMagnify
ands
ave
rap
andedSwirl
inch

www.DelphiXEbbs.com

59

Delphi XE2 FireMonkey

: TGaussianBlurFilter
: GaussianBlur
: An effect that GaussianBlurs.

: BlurAmount
: The GaussianBlur factor.
: vtFloat
: 1
: .01
: 1
: 10
//-----------------------------------------------: TBlurFilter
: BoxBlur
: An effect that blurs.

: BlurAmount
: The blur factor.
: vtFloat
: 1
: .01
: 1
www.DelphiXEbbs.com

60

Delphi XE2 FireMonkey


: 10
//-----------------------------------------------: TDirectionalBlurFilter
: DirectionalBlur
: An effect that blurs in a single direction.

: Angle
: The direction of the blur (in degrees).
: vtFloat
: 0
: 0
: 0
: 360

: BlurAmount
: The scale of the blur (as a fraction of the input size).
: vtFloat
: 1
: .01
: 1
: 10
//-----------------------------------------------: TZoomBlurFilter
: RadialBlur
www.DelphiXEbbs.com

61

Delphi XE2 FireMonkey


: An effect that applies a radial blur to the input.

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: BlurAmount
: The scale of the blur (as a fraction of the input size).
: vtFloat
: 1
: .01
: 1
: 10
//-----------------------------------------------: TAffineFilter
: AffineTransform
: Applies an affine transform to an image.

: Center
: The center point of the rotation.
www.DelphiXEbbs.com

62

Delphi XE2 FireMonkey


: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Rotation
: Rotation angle in degrees.
: vtFloat
: 0
: -180
: 0
: 180

: Scale
: Scale value as floating.
: vtFloat
: 1
: .05
: 1
: 4
//-----------------------------------------------: TPerspectiveFilter
: PerspectiveTransform
www.DelphiXEbbs.com

63

Delphi XE2 FireMonkey


: Applies an perspective transform to an image.

: TopLeft
: Top left point of result transformation.
: vtPoint
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 65535:65535

: TopRight
: Top right point of result transformation.
: vtPoint
: fxpoint 300:0
: fxpoint 0:0
: fxpoint 300:0
: fxpoint 65535:65535

: BottomRight
: Bottom right point of result transformation.
: vtPoint
: fxpoint 350:300
: fxpoint 0:0
: fxpoint 350:300
www.DelphiXEbbs.com

64

Delphi XE2 FireMonkey


: fxpoint 65535:65535

: BottomLeft
: Bottom left point of result transformation.
: vtPoint
: fxpoint 0:300
: fxpoint 0:0
: fxpoint 0:300
: fxpoint 65535:65535
//-----------------------------------------------: TCropFilter
: Crop
: The size and shape of the cropped image depend on the rectan
gle you specify.

: LeftTop
: Left-top corner of cropping rect
: vtPoint
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 65535:65535

: RightBottom
www.DelphiXEbbs.com

65

Delphi XE2 FireMonkey


: Left-top corner of cropping rect
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535
//-----------------------------------------------: TBandedSwirlTransition
: BandedSwirlTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Strength
: The amount of twist to the spiral.
: vtFloat
: 1
www.DelphiXEbbs.com

66

Delphi XE2 FireMonkey


: 0
: 1
: 10

: Frequency
: The frequency of the spiral.
: vtFloat
: 20
: 0
: 20
: 100

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------www.DelphiXEbbs.com

67

Delphi XE2 FireMonkey


: TBlindTransition
: BlindTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: NumberOfBlinds
: The number of Blinds strips
: vtFloat
: 5
: 2
: 5
: 15

: Target
: The target bitmap.
: vtBitmap
www.DelphiXEbbs.com

68

Delphi XE2 FireMonkey


//-----------------------------------------------: TBloodTransition
: BloodTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: .3
: 0
: .3
: 1

: Target
: The target bitmap.
www.DelphiXEbbs.com

69

Delphi XE2 FireMonkey


: vtBitmap
//-----------------------------------------------: TCircleTransition
: CircleTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: FuzzyAmount
: The fuzziness factor.
: vtFloat
: .1
: 0
: .1
: 1

: Size
www.DelphiXEbbs.com

70

Delphi XE2 FireMonkey


: The size of the circle.
: vtFloat
: 1
: 0
: 1
: 2

: Center
: The center point of effect.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TMagnifyTransition
: MagnifyTransition
: A transition effect.

: Progress
www.DelphiXEbbs.com

71

Delphi XE2 FireMonkey


: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Center
: The center point of effect.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TCrumpleTransition
: CrumpleTransition
: A transition effect.

www.DelphiXEbbs.com

72

Delphi XE2 FireMonkey


: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: 0
: -1
: 0
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TDissolveTransition
: DissolveTransition
: A transition effect.
www.DelphiXEbbs.com

73

Delphi XE2 FireMonkey

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: 0
: -1
: 0
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TDropTransition
: DropTransition
www.DelphiXEbbs.com

74

Delphi XE2 FireMonkey


: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: 0
: -1
: 0
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TFadeTransition
www.DelphiXEbbs.com

75

Delphi XE2 FireMonkey


: FadeTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TBrightTransition
: BrightTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
www.DelphiXEbbs.com

76

Delphi XE2 FireMonkey


: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TPixelateTransition
: PixelateTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
www.DelphiXEbbs.com

77

Delphi XE2 FireMonkey


//-----------------------------------------------: TBlurTransition
: BlurTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TWiggleTransition
: WiggleTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
www.DelphiXEbbs.com

78

Delphi XE2 FireMonkey


: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TShapeTransition
: ShapeTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
www.DelphiXEbbs.com

79

Delphi XE2 FireMonkey


: The target bitmap.
: vtBitmap
//-----------------------------------------------: TRippleTransition
: RippleTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TRotateCrumpleTransition
: RotateCrumpleTransition
: A transition effect.

: Progress
www.DelphiXEbbs.com

80

Delphi XE2 FireMonkey


: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: 0
: -1
: 0
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TSaturateTransition
: SaturateTransition
: A transition effect.

www.DelphiXEbbs.com

81

Delphi XE2 FireMonkey


: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TSlideInTransition
: SlideTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
www.DelphiXEbbs.com

82

Delphi XE2 FireMonkey


: 100

: SlideAmount
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint -65535:-65535
: fxpoint 150:150
: fxpoint 65535:65535

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TSwirlTransition
: SwirlTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
www.DelphiXEbbs.com

83

Delphi XE2 FireMonkey


: 30
: 100

: Strength
: The amount of twist to the spiral.
: vtFloat
: 30
: -70
: 30
: 70

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TWaterTransition
: WaterTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
www.DelphiXEbbs.com

84

Delphi XE2 FireMonkey


: 0
: 30
: 100

: RandomSeed
: The seed value that determines dripiness.
: vtFloat
: .3
: 0
: .3
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TWaveTransition
: WaveTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
www.DelphiXEbbs.com

85

Delphi XE2 FireMonkey


: 30
: 0
: 30
: 100

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TLineTransition
: LineTransition
: A transition effect.

: Progress
: The amount(%) of the transition from first texture to the se
cond texture.
: vtFloat
: 30
: 0
: 30
: 100

: Origin
: The line origin.
www.DelphiXEbbs.com

86

Delphi XE2 FireMonkey


: vtPoint
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 0:0
: fxpoint 65535:65535

: Normal
: The line normal.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Offset
: The line offset.
: vtPoint
: fxpoint 400:400
: fxpoint 0:0
: fxpoint 400:400
: fxpoint 65535:65535

: FuzzyAmount
: The fuzziness factor.
www.DelphiXEbbs.com

87

Delphi XE2 FireMonkey


: vtFloat
: .1
: 0
: .1
: 1

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TInvertFilter
: Invert
: An effect that inverts all colors.
//-----------------------------------------------: TMonochromeFilter
: Monochrome
: Remaps colors so they fall within shades of a single color.
//-----------------------------------------------: TColorKeyAlphaFilter
: ColorKeyAlpha
: An effect that makes pixels of a particular color transpare
nt.

: ColorKey
: The color that becomes transparent.
www.DelphiXEbbs.com

88

Delphi XE2 FireMonkey


: vtFloat
: 0
: -1
: 0
: 1

: Tolerance
: The tolerance in color differences.
: vtFloat
: .3
: 0
: .3
: 1
//-----------------------------------------------: TMaskToAlphaFilter
: MaskToAlpha
: Converts a grayscale image to a white image that is masked b
y alpha.
//-----------------------------------------------: THueAdjustFilter
: HueAdjust
: Changes the overall hue, or tint, of the source pixels.

: Hue
www.DelphiXEbbs.com

89

Delphi XE2 FireMonkey


: The hue offset.
: vtFloat
: 0
: -1
: 0
: 1
//-----------------------------------------------: TContrastFilter
: Contrast
: An effect that controls brightness and contrast.

: Brightness
: The brightness offset.
: vtFloat
: 0
: -1
: 0
: 1

: Contrast
: The contrast multiplier.
: vtFloat
: 1.5
: 0
www.DelphiXEbbs.com

90

Delphi XE2 FireMonkey


: 1.5
: 2
//-----------------------------------------------: TBloomFilter
: Bloom
: An effect that intensifies bright regions.

: BloomIntensity
: Intensity of the bloom image.
: vtFloat
: 1
: 0
: 1
: 1

: BaseIntensity
: Intensity of the base image.
: vtFloat
: .5
: 0
: .5
: 1

: BloomSaturation
www.DelphiXEbbs.com

91

Delphi XE2 FireMonkey


: Saturation of the bloom image.
: vtFloat
: 1
: 0
: 1
: 1

: BaseSaturation
: Saturation of the base image.
: vtFloat
: .5
: 0
: .5
: 1
//-----------------------------------------------: TGloomFilter
: Gloom
: An effect that intensifies dark regions.

: GloomIntensity
: Intensity of the gloom image.
: vtFloat
: 1
: 0
www.DelphiXEbbs.com

92

Delphi XE2 FireMonkey


: 1
: 1

: BaseIntensity
: Intensity of the base image.
: vtFloat
: .5
: 0
: .5
: 1

: GloomSaturation
: Saturation of the gloom image.
: vtFloat
: 1
: 0
: 1
: 1

: BaseSaturation
: Saturation of the base image.
: vtFloat
: .5
: 0
www.DelphiXEbbs.com

93

Delphi XE2 FireMonkey


: .5
: 1
//-----------------------------------------------: TNormalBlendFilter
: NormalBlend
: Normal blending of two images.

: Target
: The target bitmap.
: vtBitmap
//-----------------------------------------------: TFillFilter
: Fill
: Generates a solid color.

: Color
: The fill color.
: vtColor
: 4280299584
: 0
: 4280299584
: 0
//-----------------------------------------------: TFillOpaqueFilter
www.DelphiXEbbs.com

94

Delphi XE2 FireMonkey


: FillRGB
: Fill all pixels with not empty alpha.

: Color
: The fill color.
: vtColor
: 4280299584
: 0
: 4280299584
: 0
//-----------------------------------------------: TPixelateFilter
: Pixelate
:

: BlockCount
: The number of pixel blocks.
: vtFloat
: 25
: 1
: 25
: 1000
//-----------------------------------------------: TEmbossFilter
www.DelphiXEbbs.com

95

Delphi XE2 FireMonkey


: Emboss
: An effect that embosses the input.

: Amount
: The amplitude of the embossing.
: vtFloat
: .5
: 0
: .5
: 1

: Width
: The separation between samples (as a fraction of input siz
e).
: vtFloat
: 3
: 0
: 3
: 10
//-----------------------------------------------: TSharpenFilter
: Sharpen
: An effect that sharpens the input.

www.DelphiXEbbs.com

96

Delphi XE2 FireMonkey


: Amount
: The amount of sharpening.
: vtFloat
: 1
: 0
: 1
: 2
//-----------------------------------------------: TToonFilter
: Toon
: An effect that applies cartoon-like shading (posterizatio
n).

: Levels
: The number of color levels to use.
: vtFloat
: 5
: 3
: 5
: 15
//-----------------------------------------------: TSepiaFilter
: Sepia
: Sepia effect.
www.DelphiXEbbs.com

97

Delphi XE2 FireMonkey

: Amount
: The amount of sharpening.
: vtFloat
: .5
: 0
: .5
: 1
//-----------------------------------------------: TPaperSketchFilter
: PaperSketch
: An paper sketch effect.

: BrushSize
: The brush size of the sketch effect.
: vtFloat
: 3
: .6
: 3
: 10
//-----------------------------------------------: TPencilStrokeFilter
: PencilStroke
: An pencil stroke effect.
www.DelphiXEbbs.com

98

Delphi XE2 FireMonkey

: BrushSize
: The brush size of the sketch effect.
: vtFloat
: 5
: 1
: 5
: 19
//-----------------------------------------------: TTilerFilter
: Tiler
: Pixel shader tiles the image across multiple rows and colum
ns

: VerticalTileCount
: The number of verical tiles to add to the output. The higher
the value the more tiles.
: vtFloat
: 4
: 0
: 4
: 20

: HorizontalTileCount

www.DelphiXEbbs.com

99

Delphi XE2 FireMonkey


: The number of horizontal tiles to add to the output. The hig
her the value the more tiles.
: vtFloat
: 3
: 0
: 3
: 20

: HorizontalOffset
: Change the horizontal offset of each tile.
: vtFloat
: 0
: 0
: 0
: 1

: VerticalOffset
: Change the vertical offset of each tile.
: vtFloat
: 0
: 0
: 0
: 1
//-----------------------------------------------www.DelphiXEbbs.com

100

Delphi XE2 FireMonkey


: TRippleFilter
: Ripple
: An effect that superimposes rippling waves upon the input.

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Amplitude
: The amplitude of the ripples.
: vtFloat
: .1
: 0
: .1
: 1

: Frequency
: The frequency of the ripples.
: vtFloat
: 70
www.DelphiXEbbs.com

101

Delphi XE2 FireMonkey


: 0
: 70
: 100

: Phase
: The phase of the ripples.
: vtFloat
: 0
: -20
: 0
: 20

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
: 2
//-----------------------------------------------: TSwirlFilter
: Swirl
: An effect that swirls the input in a spiral.

www.DelphiXEbbs.com

102

Delphi XE2 FireMonkey


: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Strength
: The amount of twist to the spiral.
: vtFloat
: 10
: -70
: 10
: 70

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
: 2
www.DelphiXEbbs.com

103

Delphi XE2 FireMonkey


//-----------------------------------------------: TMagnifyFilter
: Magnify
: An effect that magnifies a circular region.

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Radius
: The radius of the magnified region.
: vtFloat
: .25
: 0
: .25
: 1

: Magnification
: The magnification factor.
: vtFloat
www.DelphiXEbbs.com

104

Delphi XE2 FireMonkey


: 2
: 1
: 2
: 5

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
: 2
//-----------------------------------------------: TSmoothMagnifyFilter
: SmoothMagnify
: An effect that magnifies a circular region.

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535
www.DelphiXEbbs.com

105

Delphi XE2 FireMonkey

: InnerRadius
: The inner radius of the magnified region.
: vtFloat
: .2
: 0
: .2
: 1

: OuterRadius
: The outer radius of the magnified region.
: vtFloat
: .4
: 0
: .4
: 1

: Magnification
: The magnification factor.
: vtFloat
: 2
: 1
: 2
: 5
www.DelphiXEbbs.com

106

Delphi XE2 FireMonkey

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
: 2
//-----------------------------------------------: TBandsFilter
: Bands
: An effect that creates bands of bright regions.

: BandDensity
: The number of verical bands to add to the output. The higher
the value the more bands.
: vtFloat
: 65
: 0
: 65
: 150

: BandIntensity
: Intensity of each band.

www.DelphiXEbbs.com

107

Delphi XE2 FireMonkey


: vtFloat
: .2
: 0
: .2
: 1
//-----------------------------------------------: TWaveFilter
: Wave
: An effect that applies a wave pattern to the input.

: Time
: The moment in time. Animate this value over a long period of
time. The speed depends on the size. The larger the size, the larger
the increase in time on every frame, thus from 0 to 2048 in a smalle
r amount of time.
: vtFloat
: 0
: 0
: 0
: 2048

: WaveSize
: The distance between waves. (the higher the value the clos e
r the waves are to their neighbor).
: vtFloat
www.DelphiXEbbs.com

108

Delphi XE2 FireMonkey


: 64
: 32
: 64
: 256
//-----------------------------------------------: TWrapFilter
: Wrap
: Wrap image by two Bezier curves.

: LeftStart
: Left wrap curve start point
: vtFloat
: 0
: 0
: 0
: 1

: LeftControl1
: Left wrap curve control point 1
: vtFloat
: .25
: 0
: .25
: 1
www.DelphiXEbbs.com

109

Delphi XE2 FireMonkey

: LeftControl2
: Left wrap curve control point 2
: vtFloat
: .25
: 0
: .25
: 1

: LeftEnd
: Left wrap curve end point
: vtFloat
: 0
: 0
: 0
: 1

: RightStart
: Right wrap curve start point
: vtFloat
: 1
: 0
: 1
: 1
www.DelphiXEbbs.com

110

Delphi XE2 FireMonkey

: RightControl1
: Right wrap curve control point 1
: vtFloat
: .75
: 0
: .75
: 1

: RightControl2
: Right wrap curve control point 2
: vtFloat
: .75
: 0
: .75
: 1

: RightEnd
: Right wrap curve end point
: vtFloat
: 1
: 0
: 1
: 1
www.DelphiXEbbs.com

111

Delphi XE2 FireMonkey


//-----------------------------------------------: TBandedSwirlFilter
: BandedSwirl
: An effect that swirls the input in alternating clockwise an
d counterclockwise bands.

: Center
: The center point of the ripples.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
: fxpoint 65535:65535

: Bands
: The number of bands in the swirl.
: vtFloat
: 10
: 0
: 10
: 20

: Strength
: The amount of twist to the spiral.

www.DelphiXEbbs.com

112

Delphi XE2 FireMonkey


: vtFloat
: 30
: -70
: 30
: 70

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
: 2
//-----------------------------------------------: TPinchFilter
: Pinch
: An effect that pinches a circular region.

: Center
: The center point of the pinched region.
: vtPoint
: fxpoint 150:150
: fxpoint 0:0
: fxpoint 150:150
www.DelphiXEbbs.com

113

Delphi XE2 FireMonkey


: fxpoint 65535:65535

: Radius
: The radius of the pinched region.
: vtFloat
: .25
: 0
: .25
: 1

: Strength
: The amount of twist to the spiral.
: vtFloat
: 10
: 0
: 10
: 20

: AspectRatio
: The aspect ratio (width / height) of the input.
: vtFloat
: 1.5
: .5
: 1.5
www.DelphiXEbbs.com

114

Delphi XE2 FireMonkey


: 2
//------------------------------------------------

Delphi XE2 FireMonkey (15) - :


:

TObject -> TPersistent -> TFilter -> TShaderFilter -> { }

// FMX.Filter :
procedure FillCategory(AList: TStrings);
procedure FillFiltersInCategory(const Category: string; AList: TStr
ings);
function FilterByName(const AName: string): TFilter;
function FilterClassByName(const AName: string): TFilterClass;

FillCategory():

FillCategory(ListBox1.Items);

FillFiltersInCategory():

FillFiltersInCategory('', ListBox2.Items);

FilterByName():

var
www.DelphiXEbbs.com

115

Delphi XE2 FireMonkey


filter: TFilter;
begin
filter := FilterByName(''); //,
end;

TFilter FilterAttr():

var
filter: TFilter;
filterRec: TFilterRec; // TFilterRec
begin
filter := FilterByName('');
filterRec := filter.FilterAttr;
{ FilterAttr class , }
filterRec := FilterClassByName('').FilterAttr;
end;

TFilterRec :

TFilterRec = record
Name: string;

//

Desc: string;

//

Values: TShaderValueRecArray; //, TShaderValueRec


end;

TShaderValueRec :

www.DelphiXEbbs.com

116

Delphi XE2 FireMonkey


TShaderValueRec = record
Name: string;

//

Desc: string;

//

ValueType: TShaderValueType; //: vtFloat, vtPoint, vtColor,


vtBitmap()
Value: Variant;
Min, Max, Default: Variant;

//
//

end;

: TListBox TMemo, OnCreate TListBox OnClick .

uses System.TypInfo; //

procedure TForm1.FormCreate(Sender: TObject);


begin
FillCategory(ListBox1.Items); //
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
strItem1: string;
begin
strItem1 := ListBox1.Items[ListBox1.ItemIndex];
FillFiltersInCategory(strItem1, ListBox2.Items); //

ListBox2.ItemIndex := 0;
ListBox2.OnClick(nil);
www.DelphiXEbbs.com

117

Delphi XE2 FireMonkey


end;
procedure TForm1.ListBox2Click(Sender: TObject);
var
strItem2: string;
filter: TFilter;
filterRec: TFilterRec;
shaderValueRec: TShaderValueRec;
begin
strItem2 := ListBox2.Items[ListBox2.ItemIndex];
filter := FilterByName(strItem2); //
filterRec := filter.FilterAttr;
//

//

filterRec := FilterClassByName(strItem).FilterAttr; //

Memo1.Text :=

': ' + filter.ToString; //ClassName

Memo1.Lines.Add(': ' + filterRec.Name);


Memo1.Lines.Add(': ' + filterRec.Desc);
Memo1.Lines.Add('-----------------------------------------------');
for shaderValueRec in filterRec.Values do
begin
Memo1.Lines.Add(': ' + shaderValueRec.Name);
Memo1.Lines.Add(': ' + shaderValueRec.Desc);
Memo1.Lines.Add(': ' + GetEnumName(TypeInfo(TShaderValueT
ype), Integer(shaderValueRec.ValueType)));
if shaderValueRec.ValueType <> TShaderValueType.vtBitmap then
begin
Memo1.Lines.Add(': ' + string(shaderValueRec.Value));
www.DelphiXEbbs.com

118

Delphi XE2 FireMonkey


Memo1.Lines.Add(': ' + string(shaderValueRec.Min));
Memo1.Lines.Add(': ' + string(shaderValueRec.Default));
Memo1.Lines.Add(': ' + string(shaderValueRec.Max));
end;
Memo1.Lines.Add(EmptyStr);
end;
end;

Delphi XE2 FireMonkey (16) - :


TImageTOpenDialog .

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Objects;
type
TForm1 = class(TForm)
Image1: TImage;
OpenDialog1: TOpenDialog;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
www.DelphiXEbbs.com

119

Delphi XE2 FireMonkey


Button6: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses FMX.Filter;
var
bit: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
begin
bit := TBitmap.Create(0, 0);
if not OpenDialog1.Execute then Exit;
bit.LoadFromFile(OpenDialog1.FileName);
Image1.Bitmap.Assign(bit);
Image1.SetBounds(10, 10, bit.Width, bit.Height);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
www.DelphiXEbbs.com

120

Delphi XE2 FireMonkey


bit.Free;
end;

{: }
procedure TForm1.Button1Click(Sender: TObject);
var
filter: TFilter;
begin
filter := FilterByName('GaussianBlur');

//GaussianBlur

//BlurAmount

filter.Values['BlurAmount'] := 0.25;
, 1(0.1..10)
filter.ValuesAsBitmap['input'] := bit;

//input

,
Image1.Bitmap := filter.ValuesAsBitmap['output']; //output

end;

{: }
procedure TForm1.Button2Click(Sender: TObject);
var
filter: TFilter;
begin
filter := FilterByName('Invert');

//

filter.ValuesAsBitmap['input'] := bit;
Image1.Bitmap := filter.ValuesAsBitmap['output'];
end;

{: }
procedure TForm1.Button3Click(Sender: TObject);
www.DelphiXEbbs.com

121

Delphi XE2 FireMonkey


var
filter: TFilter;
begin
filter := FilterByName('Monochrome');
filter.ValuesAsBitmap['input'] := bit;
Image1.Bitmap := filter.ValuesAsBitmap['output'];
end;

{: }
procedure TForm1.Button4Click(Sender: TObject);
var
filter: TFilter;
begin
filter := FilterByName('Pixelate');
filter.Values['BlockCount'] := 30; {25 : 1..1000}
filter.ValuesAsBitmap['input'] := bit;
Image1.Bitmap := filter.ValuesAsBitmap['output'];
end;

{: }
procedure TForm1.Button5Click(Sender: TObject);
var
filter: TFilter;
begin
filter := FilterByName('Contrast');
filter.Values['Brightness'] := -0.5; {-1..1}
filter.Values['Contrast']

:= 1.5;

{0..2}

filter.ValuesAsBitmap['input'] := bit;
Image1.Bitmap := filter.ValuesAsBitmap['output'];
end;

{: }
procedure TForm1.Button6Click(Sender: TObject);
www.DelphiXEbbs.com

122

Delphi XE2 FireMonkey


var
filter: TFilter;
begin
filter := FilterByName('PerspectiveTransform');
filter.Values['TopLeft'] := VarFromPointXY(0, 0);
filter.Values['TopRight'] := VarFromPointXY(bit.Width, 0);
filter.Values['BottomRight'] := VarFromPointXY(bit.Width * 2, bit.
Height * 2);
filter.Values['BottomLeft'] := VarFromPointXY(0, bit.Height);
filter.ValuesAsBitmap['input'] := bit;
Image1.Bitmap := filter.ValuesAsBitmap['output'];
Image1.SetBounds(10, 10, bit.Width * 2, bit.Height * 2);
end;
end.

Transition :

uses FMX.Filter;
var
bit1,bit2: TBitmap;

{}
procedure TForm1.FormCreate(Sender: TObject);
var
filter: TFilter;
begin
bit1 := TBitmap.Create(0, 0);
bit2 := TBitmap.Create(0, 0);
bit1.LoadFromFile('C:\Temp\test1.jpg');
bit2.LoadFromFile('C:\Temp\test2.jpg');
www.DelphiXEbbs.com

123

Delphi XE2 FireMonkey

filter := FilterByName('BlindTransition');
filter.Values['Progress'] := 50;

//: 0..100;

, PropertyName := 'Value'
filter.Values['NumberOfBlinds'] := 10; //: 2..15

filter.ValuesAsBitmap['input'] := bit1;
filter.ValuesAsBitmap['target'] := bit2; //target
Image1.Bitmap := filter.ValuesAsBitmap['output'];
Image1.SetBounds(10, 10, bit1.Width, bit1.Height);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
bit1.Free;
bit2.Free;
end;

Delphi XE2 FireMonkey (17) -


XE2 , Tool Palette Effects ...
, FMX.Effects FMX.Filter.Effects .
FMX.Effects , FMX.Filter.Effects ;
.
; FMX.Types TEffect, TriggerE
nabledGetDisablePaint .

: TPanel

www.DelphiXEbbs.com

124

Delphi XE2 FireMonkey

{ Panel1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
with TShadowEffect.Create(Self) do
begin
Parent := Panel1;

//

Distance := 3.0;

//

Direction := 45.0;

//

Softness := 0.3;

//

Opacity := 0.6;

//

ShadowColor := claBlack; //
Trigger := 'IsMouseOver=true'; //, TEffec
t , ()
end;
end;

Delphi XE2 FireMonkey (18) - TLang()


TLang , , . :

1 AddLang('') , : AddLang('en')AddLang('cn').
2 TStrings , : LangStr['en']LangStr['cn'].
3 LoadFromFile() SaveToFile() (*. lng)
.
4 Lang , Lang := 'cn'.

www.DelphiXEbbs.com

125

Delphi XE2 FireMonkey


5, ( TText)
.

:
1 TLang;
2 TRadioButton, ;
3 TButtonTCheckBoxTLabel ;
4 RadioButton1Button1 .

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Objects;
type
TForm1 = class(TForm)
Lang1: TLang;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Button1: TButton;
CheckBox1: TCheckBox;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure RadioButton1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;

www.DelphiXEbbs.com

126

Delphi XE2 FireMonkey


var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
RadioButton1.Text := 'English';
RadioButton2.Text := '';
RadioButton3.Text := '';
RadioButton1.Tag := 0;
RadioButton2.Tag := 1;
RadioButton3.Tag := 2;
RadioButton2.OnChange := RadioButton1.OnChange;
RadioButton3.OnChange := RadioButton1.OnChange;

{ TLang }
Button1.Text := 'Button';
CheckBox1.Text := 'CheckBox';
Label1.Text := 'Test';
Caption := 'Test';

{}
Lang1.AddLang('en');
Lang1.AddLang('cn');
Lang1.AddLang('big');

{Original: TStrings }
with Lang1.Original do
begin
www.DelphiXEbbs.com

127

Delphi XE2 FireMonkey


Add('Button');
Add('CheckBox');
Add('Test');
end;

{en }
with Lang1.LangStr['en'] do
begin
Add('Button');
Add('CheckBox');
Add('Test');
end;

{}
with Lang1.LangStr['cn'] do
begin
Values['Button'] := '';
Values['CheckBox'] := '';
Values['Test'] := '';
//

Values[Lang1.Original[0]] := '';

//

Values[Lang1.Original[1]] := '';

//

Values[Lang1.Original[2]] := '';

end;

{}
with Lang1.LangStr['big'] do
begin
Values['Button'] := '';
Values['CheckBox'] := '';
www.DelphiXEbbs.com

128

Delphi XE2 FireMonkey


Values['Test'] := '';
end;
end;

{}
procedure TForm1.RadioButton1Change(Sender: TObject);
begin
case TRadioButton(Sender).Tag of
0: Lang1.Lang := 'en';
1: Lang1.Lang := 'cn';
2: Lang1.Lang := 'big';
end;
end;

{ Resources , TStrings }
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Lang1.Resources.Count - 1 do
ShowMessage(TStrings(Lang1.Resources.Objects[i]).Text);
end;
end.

Delphi XE2 FireMonkey (19) - TFmxObject ()


: FMX ()

www.DelphiXEbbs.com

129

Delphi XE2 FireMonkey


IFreeNotifi
cation
TBitmapAnimatio
n
TBitmapListAnim
ation
TColorAnimation
TColorKeyAnimat
TAnimatio ion
n

TFloatAnimation
TFloatKeyAnimat
ion
TGradientAnimati

TFmxO

on

bject
TPathAnimation
TRectAnimation
TBitmapO
bject
TBrushObj
ect
TOpenDialog

TSaveDialog

TPageSetupDialo
TCommon g
Dialog

TPrintDialog
TPrinterSetupDia
log

TCustomP TPopupMenu

www.DelphiXEbbs.com

IItemsContainer

130

Delphi XE2 FireMonkey


opupMenu
TBevelEffect
TBlurEffect
TGlowEffect
TEffect

TInnerGlowEffect
TImageFXEffect

TImageFXEffect
-> 57
TReflectionEffect
TShadowEffect
TFilterBas TFilterBaseFilter
eFilter

-> 57

TLang
TPathObje
ct
TStyleBoo
k
TTimer
IControl
TCamera
TDummy

TModel3D

TGrid3D
TControl3 TLight
D

TProxyObject
TSelectionPoint3
D
TCone
TShape3D

TCustomMesh
TCube

www.DelphiXEbbs.com

131

Delphi XE2 FireMonkey


TCylinder
TMesh
TPlane
TRoundCub
e
TSphere
TEllipse3D
TPath3D
TExtrudedShape
3D

TRectangle
3D
TText3D

TStrokeCube
IAlignableObject,
IAlignRoot
TBufferLaye
r3D
IScene,
TAbstractLayer3 TCustomBufferLa
D

yer3D

IContainerObj
TCustomLa

ect

yer3D
TLayer3D
TTextLayer3D
TImage3D
TLayout3D
IControl,
IContainerObjec
TControl
t,
IAlignRoot,

www.DelphiXEbbs.com

132

Delphi XE2 FireMonkey


IAlignableObject
TContent

TScrollContent

TGridLayout
TImage
TCustomBindNav TBindNavig
TLayout
igator

ator

TCustomPath

TPath

TPaintBox
TPlotGrid
TScaledLayout
TSelection
TSelectionPoint

TArc
TEllipse

TCircle
TPie

TShape

TLine
TCalloutRec
TRectangle
tangle
TRoundRect
TText
TAniIndicator
TArcDial
TCalendar

TStyledControl
TColorBox
TColorPanel
TColorPicker

www.DelphiXEbbs.com

133

Delphi XE2 FireMonkey


TColorQuad
TCheckColu
mn
TImageCol
umn
TPopupColu
TColumn
mn
TProgressC
olumn
TStringColu
mn
TComboColorBox
TTrack
TAlphaTra
ckBar
TCustomTrack

TBitmapTrack TBWTrack
TTrackBar
Bar

Bar
THueTrac
kBar

TGradientEdit
TImageControl

TImageCell
TCalloutPan

TPanel
el
TPathLabel
TPopup
TProgressC
TProgressBar
ell

www.DelphiXEbbs.com

134

Delphi XE2 FireMonkey


TSmallScrol
TScrollBar
lBar
TFramedSc
rollBox
TImageVie
wer
TVertScroll TFramedVertS
Box

crollBox
IIMENotificatio

TMemo
n
IItemsContain
TCustomGri er
d
TScrollBox

TGrid
TStringGrid
IItemsContain
er
TComboEditLis

TCustomLis tBox
tBox

TComboListBo
x
TColorList
TListBox
Box
IItemsContain

TCustomTr

er

eeView
TTreeView
TSplitter
TStatusBar

www.DelphiXEbbs.com

135

Delphi XE2 FireMonkey


TCalendarB
ox
TCheckBox TCheckCell
TButton
TColorButton
TCornerB TBindNav
TCustomCorne utton
rButton

Button

THeaderIt

TCustomBu
em
tton
TExpanderButt
on
TPopupCel
TPopupBox
l
TSpeedButton

TTextControl
TDropTarge
t
TExpander
TGroupBox
TLabel
TListBoxIte
m
TRadioButt
on
TTabItem

IItemsContain
TMenuItem
er
TTreeViewI IItemsContain

www.DelphiXEbbs.com

136

Delphi XE2 FireMonkey


tem

er

TThumb
TToolBar
IIMENotific
ation
TCalendarE
dit
TClearingEd
it
TComboEdi
TCustomEdit

t
TComboTra
ckBar
TEdit

TTextCell

TNumberBo
x
TSpinBox
IItemsCont
TCustomComboB ainer
ox

TColorComboB
TComboBox
ox
IItemsCont

THeader
ainer
IItemsCont
TTabControl
ainer
IMenuView,
TMenuBar
IItemsCon

www.DelphiXEbbs.com

137

Delphi XE2 FireMonkey


tainer
TSizeGrip
TViewport3D

ISizeGrip

IViewport3D

TMainMen
IItemsContainer
u
IRoot,
IContainerObjec
t,
TCommon IAlignRoot
CustomFor
m

IScene
TCustomForm
TForm
IViewport3D
TCustomForm3D
TForm3D

TImageFXEffect 57 :

TAffineTransformEffect

TBandedSwirlEffect
TBandedSwirlTransitionEffect
TBandsEffect
TBlindTransitionEffect
TBloodTransitionEffect
TBloomEffect
TBlurTransitionEffect
TBoxBlurEffect
TBrightTransitionEffect
TCircleTransitionEffect
TColorKeyAlphaEffect
TContrastEffect
TCropEffect
TCrumpleTransitionEffect
www.DelphiXEbbs.com

138

Delphi XE2 FireMonkey


TDirectionalBlurEffect
TDissolveTransitionEffect
TDropTransitionEffect
TEmbossEffect
TFadeTransitionEffect
TFillEffect
TFillRGBEffect
TGaussianBlurEffect
TGloomEffect
THueAdjustEffect
TInvertEffect
TLineTransitionEffect
TMagnifyEffect
TMagnifyTransitionEffect
TMaskToAlphaEffect
TMonochromeEffect
TNormalBlendEffect
TPaperSketchEffect
TPencilStrokeEffect
TPerspectiveTransformEffect
TPinchEffect
TPixelateEffect
TPixelateTransitionEffect
TRadialBlurEffect
TRippleEffect
TRippleTransitionEffect
TRotateCrumpleTransitionEffect
TSaturateTransitionEffect
TSepiaEffect
TShapeTransitionEffect
TSharpenEffect
TSlideTransitionEffect
TSmoothMagnifyEffect
TSwirlEffect
www.DelphiXEbbs.com

139

Delphi XE2 FireMonkey


TSwirlTransitionEffect
TTilerEffect
TToonEffect
TWaterTransitionEffect
TWaveEffect
TWaveTransitionEffect
TWiggleTransitionEffect
TWrapEffect

TFilterBaseFilter 57 :

TFilterAffineTransform

TFilterBandedSwirl
TFilterBandedSwirlTransition
TFilterBands
TFilterBlindTransition
TFilterBloodTransition
TFilterBloom
TFilterBlurTransition
TFilterBoxBlur
TFilterBrightTransition
TFilterCircleTransition
TFilterColorKeyAlpha
TFilterContrast
TFilterCrop
TFilterCrumpleTransition
TFilterDirectionalBlur
TFilterDissolveTransition
TFilterDropTransition
TFilterEmboss
TFilterFadeTransition
TFilterFill
TFilterFillRGB
www.DelphiXEbbs.com

140

Delphi XE2 FireMonkey


TFilterGaussianBlur
TFilterGloom
TFilterHueAdjust
TFilterInvert
TFilterLineTransition
TFilterMagnify
TFilterMagnifyTransition
TFilterMaskToAlpha
TFilterMonochrome
TFilterNormalBlend
TFilterPaperSketch
TFilterPencilStroke
TFilterPerspectiveTransform
TFilterPinch
TFilterPixelate
TFilterPixelateTransition
TFilterRadialBlur
TFilterRipple
TFilterRippleTransition
TFilterRotateCrumpleTransition
TFilterSaturateTransition
TFilterSepia
TFilterShapeTransition
TFilterSharpen
TFilterSlideTransition
TFilterSmoothMagnify
TFilterSwirl
TFilterSwirlTransition
TFilterTiler
TFilterToon
TFilterWaterTransition
TFilterWave
TFilterWaveTransition
TFilterWiggleTransition
www.DelphiXEbbs.com

141

Delphi XE2 FireMonkey


TFilterWrap

Delphi XE2 FireMonkey (20) - TStyleBook()


"" "" "", .

FMX , , *.style .
XE2 "...\Program Files\Embarcadero\RAD Studio\9.0\Redist\styles\Fmx\"
:

Air.Style

Amakrits.Style
AquaGraphite.style
Blend.Style
dark.style
FMX.Platform.iOS.style
FMX.Platform.Mac.style
FMX.Platform.Win.style
GoldenGraphite.Style
iOS.Style
MacBlue.Style
MacGraphite.Style
RubyGraphite.style
Windows7.Style

, , TStyleBook .
, :

procedure TForm1.Button1Click(Sender: TObject);


begin

www.DelphiXEbbs.com

142

Delphi XE2 FireMonkey


Application.StyleFileName := ''; // exe ,

end;

TStyleBook(StyleBook1), .
StyleBook1 , StyleBook :

procedure TForm1.Button1Click(Sender: TObject);


begin
Self.StyleBook := StyleBook1; //
end;

StyleBook TStyleBook , :

procedure TForm1.Button1Click(Sender: TObject);


begin
StyleBook := TStyleBook.Create(Self); //, StyleBook

StyleBook.FileName := '';

//

//StyleBook.Resource.LoadFromFile(''); //TStyleBook Re
source(TStrings)
end;

StyleLookup , :

procedure TForm1.Button1Click(Sender: TObject);


begin
Button1.StyleLookup := 'checkbox';
www.DelphiXEbbs.com

143

Delphi XE2 FireMonkey


end;
//

*.style StyleName ():

1( T) + 'style' //
2( T)

//

3, , Style
Lookup
4 StyleLookup , StyleName(
StyleName ).

StyleName :

procedure TForm1.Button1Click(Sender: TObject);


begin
ShowMessage(Memo1.HScrollBar.StyleName);
ShowMessage(Memo1.VScrollBar.StyleName);
end;

ApplyStyleLookup()UpdateStyle()FindStyleResource() ,
.

(: defaultstyle, : RT_RCDATA),
:

procedure TForm1.Button1Click(Sender: TObject);


begin
www.DelphiXEbbs.com

144

Delphi XE2 FireMonkey


Application.StyleFileName := ''; //
//,

Form1.StyleBook := nil;
end;

Delphi XE2 FireMonkey (21) - FMX ()

IInterface,
IInterfaceComp
onentReference
TControlActio
TBasicAction
nLink
TApplication
TBindNavigator
Controller
TO

TPlatformCoco
TPlatform

bje TPersistent TComponent


ct

a
TScreen
TFmxObj
TFmxObject

ect
()
TBindDB

TBasicBindCom
ponent

TCustomBind
CheckLin
TBaseBindDBF TBaseBindDBF DBCheckLink

-> TContainedB
ieldLink

www.DelphiXEbbs.com

ieldControlLink

indComponent

TCustomBind TBindDB

-> -> TBaseBin

DBEditLink

EditLink

145

Delphi XE2 FireMonkey


dDBControlLink

TBindDBI
TCustomBind
mageLin
DBImageLink
k
TCustomBind TBindDB
DBListLink
TCustomBind

TBindDBMemo

DBMemoLink

Link

TCustomBind

TBindDBTextLi

DBTextLink

nk

ListLink

ICustomDBGri
d
TBaseBindDBGri
dLink

TBaseBindDB
TCustomBindD TBindDBGrid
GridControlLin
BGridLink

Link

k
TBitmapCodecC
TBitmapCodec
ocoa
TBitmapCodecQ
uartz
TBounds
TCocoaCanvasS
TCanvasSaveSta aveState
te

TQuartzCanvas
SaveState
TShaderFilter

TFilter

TShaderFilter
-> 57

TFont
TGradient

www.DelphiXEbbs.com

146

Delphi XE2 FireMonkey


TIndexBuffer
TMaterial
TMeshData
TModelImportSe
rvices
TPosition
TPosition3D
TTransform
TVertexBuffer
TAbstractPrinter TPrinter
TStrings

TListBoxStrings

TWideStrings

TListBoxStrings

TPrinterWin

IInterface
TBrushBitmap
IFreeNotificati
TBrushGrab
on
IFreeNotificati
TBrushResource
on
IFreeNotificati
TInterfacedPersi
on
stent
TCanvasCocoa
TCanvas

TCanvasQuart
z
TPrinterCanva
s
IFreeNotificati

TContext3D
on

www.DelphiXEbbs.com

147

Delphi XE2 FireMonkey


TContextOpen
GL
TCustomDirec
tXContext
IFreeNotificati
TPathData
on
IStreamPersis
t,
TBitmap

IFreeNotificati
on
TGEBitmap

TGradientPoints
TKeys
TCollection
TBaseDBGridLin TDBGridLinkC
kColumns

olumns

TGradientPoint
TColorKey
TKey
TCollectionItem

TFloatKey
TBaseDBGridLin TDBGridLinkC
kColumn

olumn
TEditActionSta

TList

TOrderedLis

TStack
ck

TSpline
IInterface
TInterfaced
Object

IBindDBGridLin
TBindDBStringGr
kControlManage
idColumnCreator
r

www.DelphiXEbbs.com

148

Delphi XE2 FireMonkey


IModelImporter
TASEModelImpo
rter
TModelImporter TDAEModelImp
orter
TOBJModelImpo
rter
IBindListEditor
IBindGridEdito
r
TBindListGridE
ditor
TBindListEditor

TBindListStrin
TBindGridEditor
gGridEditor
TBindListCom
boBoxEditor
TBindListListB
oxEditor
IBindCheckBoxE

TBindCheckBoxE ditor
ditor

TBindStateChec
kBoxEditor

TAseModel
TCustomMo
TDAEModel
del
TOBJModel
TGEMateria
TAseMaterial
l

www.DelphiXEbbs.com

149

Delphi XE2 FireMonkey


TBindDBCol TBindDBStringGr
umnFactory idColumnFactory
EAseLexerError
EAseParserError
EBindNavExcepti
on
Exception
EDAEError
EInvalidFmxHan
dle
EPrinter

TShaderFilter 57 :

TAffineFilter

TBandedSwirlFilter
TBandedSwirlTransition
TBandsFilter
TBlindTransition
TBloodTransition
TBloomFilter
TBlurFilter
TBlurTransition
TBrightTransition
TCircleTransition
TColorKeyAlphaFilter
TContrastFilter
TCropFilter
TCrumpleTransition
TDirectionalBlurFilter
TDissolveTransition
TDropTransition
TEmbossFilter
www.DelphiXEbbs.com

150

Delphi XE2 FireMonkey


TFadeTransition
TFillFilter
TFillOpaqueFilter
TGaussianBlurFilter
TGloomFilter
THueAdjustFilter
TInvertFilter
TLineTransition
TMagnifyFilter
TMagnifyTransition
TMaskToAlphaFilter
TMonochromeFilter
TNormalBlendFilter
TPaperSketchFilter
TPencilStrokeFilter
TPerspectiveFilter
TPinchFilter
TPixelateFilter
TPixelateTransition
TRippleFilter
TRippleTransition
TRotateCrumpleTransition
TSaturateTransition
TSepiaFilter
TShapeTransition
TSharpenFilter
TSlideInTransition
TSmoothMagnifyFilter
TSwirlFilter
TSwirlTransition
TTilerFilter
TToonFilter
TWaterTransition
TWaveFilter
www.DelphiXEbbs.com

151

Delphi XE2 FireMonkey


TWaveTransition
TWiggleTransition
TWrapFilter
TZoomBlurFilter

Delphi XE2 FireMonkey (22) - : BindingSourceBindingName


FindBinding()Binding[]
TrackBar1Edit1Label1, ():

procedure TForm1.FormCreate(Sender: TObject);


begin
Edit1.BindingSource := TrackBar1;

// TrackBar1 Edit1

Label1.BindingSource := TrackBar1; // TrackBar1 Label1


end;
{, Edit1.Text Label1.Text TrackBar1.Value }

, FM Data , Variant :

procedure TForm1.Button1Click(Sender: TObject);


begin
ShowMessage(TrackBar1.Data); //TrackBar1.Data <- TrackBar1.Value
ShowMessage(Label1.Data);

//Label1.Data <- Label1.Text

ShowMessage(Edit1.Text);

//Edit1.Data <- Edit1.Text

end;

BindingSource ( TButtonTPanel), (

www.DelphiXEbbs.com

152

Delphi XE2 FireMonkey


).
, :

procedure TForm1.FormCreate(Sender: TObject);


begin
Edit1.BindingSource := Edit2;
Edit2.BindingSource := Edit1;
end;

BindingSource BindingName ...:

procedure TForm1.Button1Click(Sender: TObject);


begin
Edit1.BindingName := 'bn1'; //

{ FindBinding() }
ShowMessage(Self.FindBinding('bn1').ClassName);
ShowMessage(TEdit(FindBinding('bn1')).Text);

{ Bingding[] Data }
Self.Binding['bn1'] := 'NewText';
ShowMessage(Self.Binding['bn1']); //NewText

end;

XE2 ( FM), TBindingsListTBindingsScope


TBindScopeDBTBindNavigator ...

Delphi XE2 FireMonkey (23) - : TBindingsList: TBindExpression

www.DelphiXEbbs.com

153

Delphi XE2 FireMonkey


TBindingsList .

TBindingsList (TBindExpression);
TBindExpression ,
.

1 TrackBar1Edit1Label1BindingsList1;
2 TrackBar1 ;
3 TrackBar1.Value Edit1.TextLabel1.Text, ( TrackBar
1 , Edit1Label1 ).

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngEx
t,
Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Edit;
type
TForm1 = class(TForm)
TrackBar1: TTrackBar;
Edit1: TEdit;
Label1: TLabel;
BindingsList1: TBindingsList;
procedure FormCreate(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
end;
var
www.DelphiXEbbs.com

154

Delphi XE2 FireMonkey


Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
{ BindingsList1 , }

with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Edit1;

//

ControlExpression := 'Text'; //

SourceComponent := TrackBar1; //
SourceExpression := 'Value'; //

Active := True;

//; Active := False

end;
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := TrackBar1;
SourceExpression := 'Value';
Active := True;
end;
end;

{ TrackBar1 OnChange }
procedure TForm1.TrackBar1Change(Sender: TObject);
begin

www.DelphiXEbbs.com

155

Delphi XE2 FireMonkey


BindingsList1.Notify(Sender, ''); //: BindingsList1.N
otify(TrackBar1, 'Value');
end;
end.

1 TrackBar1Edit1Label1;
2 Edit1 New LiveBinding...( Strucure Edit1 Object
Inspector LiveBindings );
3 TBindingExpression, : BindExpressionEdit11, ( Binding
sList1 );
4 BindExpressionEdit11, :

ControlComponent : 'Edit1'
ControlExpression: 'Text'
SourceComponent

: 'TrackBar1'

SourceExpression : 'Value'
5 2..4 Label1
6 TrackBar1 OnChange : BindingsList1.Notify(Sender, '');
7.

System.Bindings.Helper TBindings ( Tra


ckBar1Edit1Label1):

unit Unit1;
interface
uses

www.DelphiXEbbs.com

156

Delphi XE2 FireMonkey


System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Edit;
type
TForm1 = class(TForm)
TrackBar1: TTrackBar;
Edit1: TEdit;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses System.Bindings.Expression, System.Bindings.Helper;
procedure TForm1.FormCreate(Sender: TObject);
begin
TBindings.CreateManagedBinding(

[TBindings.CreateAssociationScope([Associate(TrackBar1, 'Input1
')])],
'Input1.Value',
[TBindings.CreateAssociationScope([Associate(Edit1, 'Output1
')])],
'Output1.Text',
nil
); // Input1Output1 ,

www.DelphiXEbbs.com

157

Delphi XE2 FireMonkey


TBindings.CreateManagedBinding(
[TBindings.CreateAssociationScope([Associate(TrackBar1, 'Input1
')])],
'Input1.Value',
[TBindings.CreateAssociationScope([Associate(Label1, 'Output1
')])],
'Output1.Text',
nil
);
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
TBindings.Notify(Sender, '');
end;
end.

Delphi XE2
FireMonkey
TBindExpression.Direction

(24)

TBindingsList:

BindingSource , ; TBindExpression Direc


tion .

Edit1Edit2BindingsList1; Edit1Edit2 .

procedure TForm1.FormCreate(Sender: TObject);


begin
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Edit2;
www.DelphiXEbbs.com

158

Delphi XE2 FireMonkey


ControlExpression := 'Text';
SourceComponent := Edit1;
SourceExpression := 'Text';
//

Direction := TExpressionDirection.dirSourceToControl; //

//

Direction := TExpressionDirection.dirControlToSource; //
Direction := TExpressionDirection.dirBidirectional;

//

Active := True;
end;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;

Direct ion , :

procedure TForm1.FormCreate(Sender: TObject);


begin
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Edit2;
ControlExpression := 'Text';
SourceComponent := Edit1;
SourceExpression := 'Text';
Active := True;
www.DelphiXEbbs.com

159

Delphi XE2 FireMonkey


end;
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Edit1;
ControlExpression := 'Text';
SourceComponent := Edit2;
SourceExpression := 'Text';
Active := True;
end;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;

Delphi XE2 FireMonkey (25) - : TBindingsList:

, .
TBindingsList.Methods ( System.Bindings.Methods
Data.Bind.EngExt ):

ToStr()
ToVariant()
Round()
www.DelphiXEbbs.com

160

Delphi XE2 FireMonkey


Format()
UpperCase()
LowerCase()
FormatDateTime()
StrToDateTime()
Max()
Min()
CheckedState()
SelectedItem()
SelectedText()

: TLabel .

Label1Label2Label3BindingsList1, OnCreate OnResize


:

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngEx
t,
Fmx.Bind.DBEngExt, Data.Bind.Components;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
www.DelphiXEbbs.com

161

Delphi XE2 FireMonkey


BindingsList1: TBindingsList;
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := Form1;
SourceExpression := '": " + ToStr(Width)';
Active := True;
end;
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label2;
ControlExpression := 'Text';
SourceComponent := Form1;
//

SourceExpression := '": " + ToStr(Height)';


SourceExpression := 'Format(": %s", ToStr(Height))'; //

; Format , []
Active := True;
www.DelphiXEbbs.com

162

Delphi XE2 FireMonkey


end;
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label3;
ControlExpression := 'Text';
SourceComponent := Form1;
SourceExpression := '": " + ToStr(Width * Height)';
Active := True;
end;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
BindingsList1.Notify(Sender, 'Width');
BindingsList1.Notify(Sender, 'Height');
end;
end.

SelfOwner.

Delphi XE2 FireMonkey (26) - : TBindingsList: TBindExprItems


"" "" , TBindExpression TBindExprIt
ems .

TBindExprItems : FormatExpressionsClearExpressions,
.

www.DelphiXEbbs.com

163

Delphi XE2 FireMonkey

:
1TrackBar1 , Value Edit1.Text Edit1.Width Label1.Text;
2, Edit1 "".

: TrackBar1Edit1Label1BindingsList1CheckBox1, TrackBar1
ChengkBox1 :

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngEx
t,
Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Edit;
type
TForm1 = class(TForm)
TrackBar1: TTrackBar;
Edit1: TEdit;
Label1: TLabel;
BindingsList1: TBindingsList;
CheckBox1: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
end;
var
Form1: TForm1;
www.DelphiXEbbs.com

164

Delphi XE2 FireMonkey


implementation
{$R *.fmx}
var
bindExprItems: TBindExprItems;
procedure TForm1.FormCreate(Sender: TObject);
begin
bindExprItems := TBindExprItems.Create(BindingsList1);
with bindExprItems do
begin
ControlComponent := Edit1;

//

SourceComponent := TrackBar1; //
{ TrackBar1.Value Edit1.Text}
with FormatExpressions.AddExpression do
begin
ControlExpression := 'Text';
SourceExpression := 'Value';
end;
{ TrackBar1.Value Edit1.Width}
with FormatExpressions.AddExpression do
begin
ControlExpression := 'Width';
SourceExpression := 'Value';
end;
{ TrackBar1.Value Label1.Text}
with FormatExpressions.AddExpression do
begin
ControlExpression := 'Owner.Label1.Text'; //Owner
SourceExpression := 'Value';
www.DelphiXEbbs.com

165

Delphi XE2 FireMonkey


end;
{...}
with ClearExpressions.AddExpression do
begin
ControlExpression := 'Self.Text';

// Self ,

SourceExpression := '""';
end;
Active := True;
end;
CheckBox1.IsChecked := True;
TrackBar1.Max := ClientWidth;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, 'Value');
end;
procedure TForm1.CheckBox1Change(Sender: TObject);
begin
bindExprItems.Active := TCheckBox(Sender).IsChecked;
end;
end.

Delphi XE2 FireMonkey (27) - : TBindingsList: TBindScope


, ( Owner ), TBindSco
pe .

www.DelphiXEbbs.com

166

Delphi XE2 FireMonkey


: TEdit Text TLabel.

Label1Edit1Edit2Edit3BindingsList1BindScope1; Edit1
.

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngEx
t,
Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Layouts, FMX.Edit;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
BindingsList1: TBindingsList;
BindScope1: TBindScope;
procedure FormCreate(Sender: TObject);
procedure Edit1Change(Sender: TObject);
end;
var
Form1: TForm1;
implementation
www.DelphiXEbbs.com

167

Delphi XE2 FireMonkey

{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := BindScope1; // BindScope1 ,

SourceExpression := 'Format("%s,%s,%s", Edit1.Text, Edit2.Text,


Edit3.Text)';
Active := True;
end;
BindScope1.Active := True; //
Edit2.OnChange := Edit1.OnChange;
Edit3.OnChange := Edit1.OnChange;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;
end.

Delphi XE2 FireMonkey (28) - : TBindingsList: :


SelectedText()CheckedState()

www.DelphiXEbbs.com

168

Delphi XE2 FireMonkey


: Label1 ListBox1 , Label2 CheckBox1 .

1: Label1Label2ListBox1CheckBox1BindingsList1BindScope1;
2 ListBox1 OnClick .

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngEx
t,
Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Layouts, FMX.ListBo
x;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
CheckBox1: TCheckBox;
BindingsList1: TBindingsList;
BindScope1: TBindScope;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
www.DelphiXEbbs.com

169

Delphi XE2 FireMonkey

{$R *.fmx}

uses Fmx.Bind.Editors; // SelectedTextSelectedItemCh


eckedState ,

procedure TForm1.FormCreate(Sender: TObject);


var
i: Integer;
begin
for i := 1 to 9 do
ListBox1.Items.Add('Item_' + IntToStr(i));
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := BindScope1;
SourceExpression := 'SelectedText(ListBox1)';
//

//

SourceExpression := 'ListBox1.Selected.Text';
Active := True;

end;
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label2;
ControlExpression := 'Text';
SourceComponent := BindScope1;
SourceExpression := 'CheckedState(CheckBox1)'; //Checked: 'True
'; Unchecked: 'False'; Grayed: ''
//

SourceExpression := 'CheckBox1.IsChecked';

//,

www.DelphiXEbbs.com

170

Delphi XE2 FireMonkey


Active := True;
end;
CheckBox1.OnClick := ListBox1.OnClick;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
BindingsList1.Notify(Sender, '');
end;
end.

Delphi XE2 FireMonkey (29) - : TBindingsList: Evaluate()

TBindingsList , Evaluate , Active


= False .
TBindExprItems EvaluateFormat.

: Label1Label2 Edit1, .

1: Label1Label2Edit1BindingsList1;
2 Edit1 OnKeyUpOnChange , .

unit Unit1;
interface
uses
www.DelphiXEbbs.com

171

Delphi XE2 FireMonkey


System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Edit, Data.B
ind.EngExt,
FMX.Bind.DBEngExt, Data.Bind.Components;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
BindingsList1: TBindingsList;
procedure FormCreate(Sender: TObject);
procedure Edit1KeyUp(Sender: TObject; var Key: Word; var KeyChar:
Char; Shift: TShiftState);
procedure Edit1Change(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
var
bindExpression1, bindExpression2: TBindExpression;
procedure TForm1.FormCreate(Sender: TObject);
begin
bindExpression1 := TBindExpression.Create(BindingsList1);
bindExpression2 := TBindExpression.Create(BindingsList1);
with bindExpression1 do
www.DelphiXEbbs.com

172

Delphi XE2 FireMonkey


begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := Edit1;
SourceExpression := 'Text';
// Active := True;
end;
with bindExpression2 do
begin
ControlComponent := Label2;
ControlExpression := 'Text';
SourceComponent := Edit1;
SourceExpression := 'UpperCase(Text)';
// Active := True;
end;
end;
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; var KeyC
har: Char; Shift: TShiftState);
begin
bindExpression1.Evaluate;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
bindExpression2.Evaluate;
end;
end.

www.DelphiXEbbs.com

173

Delphi XE2 FireMonkey


Delphi XE2 FireMonkey (30) - : TBindingsList: TBindExpression
OnAssigningValue
, ( Label1 Edit1.Text
);

TBindExpression OnAssigningValue .

TBindExpression (TBindExprItemsTBindLinkTBindListLinkTBindGridLink
TBindPositionTBindListTBindGridListTBindDBEditLinkTBindDBTextLinkTBindDBList
LinkTBindDBImageLinkTBindDBMemoLinkTBindDBCheckLinkTBindDBGridLink)
.

Label1Edit1BindingsList1, Edit1 OnKeyUp


;
OnAssingningValue , .

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants, FMX.Types,
FMX.Controls, FMX.Forms, FMX.Dialogs, Data.Bind.EngExt, Fmx.Bind.
DBEngExt, System.Rtti,
System.Bindings.Outputs, FMX.Layouts, Data.Bind.Components, FMX.E
dit;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
www.DelphiXEbbs.com

174

Delphi XE2 FireMonkey


BindingsList1: TBindingsList;
procedure FormCreate(Sender: TObject);
procedure Edit1KeyUp(Sender: TObject; var Key: Word; var KeyChar:
Char; Shift: TShiftState);
procedure MyOnAssigningValue(Sender: TObject; AssignValueRec: TB
indingAssignValueRec; var Value: TValue; var Handled: Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
with TBindExpression.Create(BindingsList1) do
begin
ControlComponent := Label1;
ControlExpression := 'Text';
SourceComponent := Edit1;
SourceExpression := 'Text';
OnAssigningValue := MyOnAssigningValue; //
Active := True;
end;
end;
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; var KeyC
har: Char; Shift: TShiftState);
begin
BindingsList1.Notify(Sender, '');
end;

www.DelphiXEbbs.com

175

Delphi XE2 FireMonkey


procedure TForm1.MyOnAssigningValue(Sender: TObject; AssignValueRec:
TBindingAssignValueRec; var Value: TValue; var Handled: Boolean);
begin
Value := Length(Value.ToString); //
end;
end.

Delphi XE2 FireMonkey (31) - :


:

DataSource1

: TDataSource;

ClientDataSet1 : TClientDataSet;
Label1

: TLabel;

Edit1

: TEdit;

Memo1

: TMemo;

ImageControl1

: TImageControl;

BindNavigator1 : TBindNavigator;

{, }
BindingsList1

: TBindingsList;

BindScopeDB1

: TBindScopeDB;

DBLinkLabel1SpeciesNo1

: TBindDBTextLink;

DBLinkEdit1Category1

: TBindDBEditLink;

DBLinkMemo1Notes1

: TBindDBMemoLink;

DBLinkImageControl1Graphic1 : TBindDBImageLink;

www.DelphiXEbbs.com

176

Delphi XE2 FireMonkey


biolife.xml( biolife.cds), : C:\Program Files\Com
mon Files\CodeGear Shared\Data\biolife.xml

1 DataSource1 DataSet ClientDataSet1;

2 ClientDataSet FileName 'C:\Program Files\Common Files\


CodeGear Shared\Data\biolife.xml';

3 biolife.xml :
Label1

-> -> Link To DB Field... -> Species No (

Edit1

-> -> Link To DB Field... -> CateGory

(stri

-> -> Link To DB Field... -> Notes

(Tex

ng)
Memo1
t)
ImageControl -> -> Link To DB Field... -> Graphic

(Gra

phics)

4 BindNavigator1 BindScope BindScopeDB1;

5 ClientDataSet1 Active True.

www.DelphiXEbbs.com

177

Delphi XE2 FireMonkey

():

DataSource1

: TDataSource;

ClientDataSet1 : TClientDataSet;
Label1

: TLabel;

Edit1

: TEdit;

Memo1

: TMemo;

ImageControl1

: TImageControl;

BindNavigator1 : TBindNavigator;
BindingsList1

: TBindingsList;

BindScopeDB1

: TBindScopeDB;

procedure TForm1.FormCreate(Sender: TObject);


begin
ClientDataSet1.FileName := 'C:\Program Files\Common Files\CodeGea
r Shared\Data\biolife.xml';
DataSource1.DataSet := ClientDataSet1;
BindScopeDB1.DataSource := DataSource1;
BindNavigator1.BindScope := BindScopeDB1;
with TBindDBTextLink.Create(BindingsList1) do
begin
ControlComponent := Label1;
DataSource := BindScopeDB1;
FieldName := 'Species No';
end;
with TBindDBEditLink.Create(BindingsList1) do
begin
www.DelphiXEbbs.com

178

Delphi XE2 FireMonkey


ControlComponent := Edit1;
DataSource := BindScopeDB1;
FieldName := 'Category';
end;
with TBindDBMemoLink.Create(BindingsList1) do
begin
ControlComponent := Memo1;
DataSource := BindScopeDB1;
FieldName := 'Notes';
end;
with TBindDBImageLink.Create(BindingsList1) do
begin
ControlComponent := ImageControl1;
DataSource := BindScopeDB1;
FieldName := 'Graphic';
end;
ClientDataSet1.Active := True;
end;

TStringGrid, (): StringGrid1 -> Link to DB DataSourc


e... -> BindScopeDB1

TStringGrid :

uses Fmx.Bind.Editors, Data.Bind.DBLinks, Fmx.Bind.DBLinks;


procedure TForm1.FormCreate(Sender: TObject);
begin

www.DelphiXEbbs.com

179

Delphi XE2 FireMonkey


ClientDataSet1.FileName := 'C:\Program Files\Common Files\CodeGea
r Shared\Data\biolife.xml';
DataSource1.DataSet := ClientDataSet1;
BindScopeDB1.DataSource := DataSource1;
BindNavigator1.BindScope := BindScopeDB1;
ClientDataSet1.Active := True;

with TBindDBGridLink.Create(BindingsList1) do // TBindGridLi


nk
begin
GridControl := StringGrid1;
DataSource := BindScopeDB1;
Active := True;
end;
end;

Delphi XE2 FireMonkey (32) - : TBindingsList: TBindList


TBindPosition [...]

Delphi XE2 FireMonkey (33) - : TFmxObject: SaveToStream


LoadFromStreamSaveToBinStreamLoadFromBinStream
SaveToStream()LoadFromStream() ;
SaveToBinStream()LoadFromBinStream() ; , .

, .

:
1: ListBox1Button1Button2
2: Button1.OnClickButton2.OnClickForm1.OnCreate

www.DelphiXEbbs.com

180

Delphi XE2 FireMonkey

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Layouts, FMX.
ListBox;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}

{ ListBox1 }
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
www.DelphiXEbbs.com

181

Delphi XE2 FireMonkey


for i := 0 to 9 do
ListBox1.Items.Add('Item' + IntToStr(i));
end;

{ ListBox1}
procedure TForm1.Button1Click(Sender: TObject);
const
path = 'c:\temp\ListBox1Stream.txt';
var
stream: TFileStream;
begin
{1}
stream := TFileStream.Create(path, fmCreate);
ListBox1.SaveToStream(stream);
stream.Free;
{2}
ListBox1.Clear;
ShowMessage('a');
{3}
stream := TFileStream.Create(path, fmOpenRead);
ListBox1.LoadFromStream(stream);
stream.Free;
end;

{}
procedure TForm1.Button2Click(Sender: TObject);
const
path = 'c:\temp\Form1Stream.dat';
var
stream: TFileStream;
begin
www.DelphiXEbbs.com

182

Delphi XE2 FireMonkey


{1}
stream := TFileStream.Create('c:\temp\Form1Stream.dat', fmCreat
e);
Self.SaveToBinStream(stream);
stream.Free;
{2}
Button1.Free;
Button2.Free;
ListBox1.Free;
Realign;
ShowMessage('a');
{3}
stream := TFileStream.Create('c:\temp\Form1Stream.dat', fmOpenRea
d);
Self.LoadFromBinStream(stream);
stream.Free;
end;
end.

:
1: Button1Button2Panel1; Panel1 TCheckBox
2: Button1.OnClickButton2.OnClickForm1.OnCreateForm1.OnDestroy

unit Unit1;
interface
uses

www.DelphiXEbbs.com

183

Delphi XE2 FireMonkey


System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs;
type
TForm1 = class(TForm)
Panel1: TPanel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
var
stream: TMemoryStream;
procedure TForm1.FormCreate(Sender: TObject);
begin
stream := TMemoryStream.Create;
Button2.Enabled := False;
end;

www.DelphiXEbbs.com

184

Delphi XE2 FireMonkey


procedure TForm1.FormDestroy(Sender: TObject);
begin
stream.Free;
end;

{ CheckBox }
procedure TForm1.Button1Click(Sender: TObject);
begin
Panel1.SaveToStream(stream);
ShowMessage(IntToStr(stream.Size));
Button2.Enabled := True;
end;

{}
procedure TForm1.Button2Click(Sender: TObject);
begin
stream.Position := 0;
Panel1.LoadFromStream(stream);
end;
end.

Delphi XE2 FireMonkey (34) - : TFmxObject:


: Clone()CloneChildFromStream().

Clone() , CloneChildFromStream() (,
).

procedure TForm1.FormCreate(Sender: TObject);


www.DelphiXEbbs.com

185

Delphi XE2 FireMonkey


var
i: Integer;
begin
for i := 0 to 9 do
ListBox1.Items.Add('Item' + IntToStr(i));
end;

{ ListBox1 Panel1}
procedure TForm1.Button1Click(Sender: TObject);
begin
Panel1.AddObject(ListBox1.Clone(Self));
end;

Delphi XE2 FireMonkey (35) - : TFmxObject:


TFmxObject TagObjectTagFloatTagString, TComponent Tag,
.

ChildrenCountChildren[] ControlCountControls[].
Children : AddObject()InsertObject()RemoveObject()Exchange()D
eleteChildren()

Index Children , ;
SendToBack()BringToFront() Index .

Root , SetRoot() .
IRoot , Root , :

procedure TForm1.Button1Click(Sender: TObject);


www.DelphiXEbbs.com

186

Delphi XE2 FireMonkey


begin
TForm(Button1.Root).Caption := 'abc';
end;

Stored Stored , .

IsIControl() TControl( IControl ); AsIControl() I


Control .

(Binding ), , .

Delphi XE2 FireMonkey (36) - : TForm


Form1.StyleLookup "formstyle" , "backgroundstyle"
...

, TRectangle :

uses FMX.Objects;
procedure TForm1.Button1Click(Sender: TObject);
begin
(Self.Children[0] as TRectangle).Fill.Color := claRed; //,
Children[0] , (Index)
ShowMessage(Children[0].ToString); //TRectangle

www.DelphiXEbbs.com

187

Delphi XE2 FireMonkey


{Panel1 , }
TRectangle(Panel1.Children[0]).Fill.Color := claYellow;
end;

FMX 8 , VCL 40 .
8 , , :
MouseDownMouseUpMouseMoveMouseLeaveMouseWheelDragDropDragEnter
DragOverDragLeaveKeyDownKeyUp .
, .

: MouseMove :

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs;
type
TForm1 = class(TForm)
private
public
{ TForm1 -> Ctrl+ -> MouseM... -> -> Shift+C
trl+C }
procedure MouseMove(Shift: TShiftState; X: Single; Y: Single); o
verride;
end;

www.DelphiXEbbs.com

188

Delphi XE2 FireMonkey


var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.MouseMove(Shift: TShiftState; X, Y: Single);
begin
inherited;
Caption := Format('%f, %f', [X, Y]);
end;
end.

TForm : TFmxObject -> TCommonCustomForm -> TCustomForm -> TForm

TCommonCustomForm TForm TForm3D ;


TCustomForm IScene , Canvas Style ;
TForm , published .

{ TCommonCustomForm }
public
constructor Create(...); override;

//

constructor CreateNew(...); virtual; // Create()


Dummy, ( 3D ); Create()
destructor Destroy; override;

//

procedure InitializeNewForm; virtual;

//,

procedure AfterConstruction; override;


www.DelphiXEbbs.com

//
189

Delphi XE2 FireMonkey


procedure BeforeDestruction; override;

//

procedure AddObject(...); override;

//

{ children }
function ObjectAtPoint(...): IControl; virtual; //
{ called from Platform }
procedure SetMarkedText(...); virtual; //,
;
procedure PaintRects(...); virtual;

//(); TC

ustomForm
procedure MouseDown(...); virtual;

//

procedure MouseMove(...); virtual;

//...

procedure MouseUp(...); virtual;

//...

procedure MouseWheel(...); virtual;

//...

procedure MouseLeave; virtual;

//...

procedure KeyDown(...); virtual;

//

procedure KeyUp(...); virtual;

//...

function GetImeWindowRect: TRectF; virtual; //

procedure Activate;

//

procedure Deactivate;

//

procedure DragEnter(...); virtual;

//

procedure DragOver(...); virtual;

//...

procedure DragDrop(...); virtual;

//...

procedure DragLeave; virtual;

//...

procedure EnterMenuLoop;

// TMenuBar StartMe

nuLoop

www.DelphiXEbbs.com

190

Delphi XE2 FireMonkey


{ settings }
procedure SetBounds(...); virtual;

//

function ClientToScreen(...): TPointF;

//

function ScreenToClient(...): TPointF;

//...

function CloseQuery: Boolean; virtual;

// OnCloseQuery

function ClientRect: TRectF;

//

procedure Release;

//

procedure Close;

//

procedure Show;

//

procedure Hide;

//

function ShowModal: TModalResult;

//

procedure CloseModal;

// OnCloseQueryOnClose

procedure Invalidate;

//

procedure BeginUpdate;

//

procedure EndUpdate;

//

property Handle: TFmxHandle ...;

//

property ContextHandle: THandle ...;

//

property ModalResult: TModalResult ...; //


property FormState: TFmxFormStates ...; //
property Designer: IDesignerHook ...;

//

{ IRoot }
property Captured: IControl ...;

//

property Focused: IControl ...;

//

www.DelphiXEbbs.com

191

Delphi XE2 FireMonkey


property Hovered: IControl ...;

//

property IsActive: Boolean ...;

//

property BiDiMode: TBiDiMode ...; //


property Caption: string ...;

//

property Cursor: TCursor ...;

//

property BorderStyle: TFmxFormBorderStyle ...; //


property BorderIcons: TBorderIcons ...;

//

property ClientHeight: Integer ...;

//

property ClientWidth: Integer ...;

//

property Margins: TBound ...;

//

property Position: TFormPosition ...;

//

property Width: Integer ...;

//

property Height: Integer ...;

//

property ShowActivated: Boolean ...;

//

property StaysOpen: Boolean ...;

//

property Transparency: Boolean ...;

//

property TopMost: Boolean ...;

//

property Visible: Boolean ...;

//

property WindowState: TWindowState ...;

//(

)
property OnCreate: TNotifyEvent ...;

//

property OnDestroy: TNotifyEvent ...;

//

www.DelphiXEbbs.com

192

Delphi XE2 FireMonkey


property OnClose: TCloseEvent ...;

//

property OnCloseQuery: TCloseQueryEvent ...;

//

property OnActivate: TNotifyEvent ...;

//

property OnDeactivate: TNotifyEvent ...;

//

property OnResize: TNotifyEvent ...;

//

published
property Left: Integer ...; //
property Top: Integer ...;

//

end;

{ TCustomForm }
public
constructor Create(...); override;

//

constructor CreateNew(...); override; //


destructor Destroy; override;
procedure InitializeNewForm; override;

//
// Form,

procedure AddObject(...); override;

//

procedure UpdateStyle;

//

property Canvas: TCanvas ...;

//

property Fill: TBrush ...;

//

property StyleBook: TStyleBook ...;

//

property ActiveControl: TStyledControl ...; //

property StyleLookup: string ...;


www.DelphiXEbbs.com

//
193

Delphi XE2 FireMonkey


property OnPaint: TOnPaintEvent ...;

//

end;

Delphi XE2 FireMonkey (37) - : TControl

{ TControl }
public
constructor Create(...); override;

//

destructor Destroy; override;

//

procedure AddObject(...); override;

//

procedure RemoveObject(...); override; //


procedure SetNewScene(...); virtual;

//

procedure SetBounds(...); virtual;

//

function AbsoluteToLocal(...): TPointF; virtual;

//

function LocalToAbsolute(...): TPointF; virtual;

//...

function AbsoluteToLocalVector(...): TVector; virtual; //...


function LocalToAbsoluteVector(...): TVector; virtual; //...
function PointInObject(...): Boolean; virtual;

//

procedure RecalcUpdateRect; virtual; //...


procedure RecalcNeedAlign; virtual;

//...

procedure RecalcOpacity; virtual;

//...

procedure RecalcAbsolute; virtual;

//...

procedure RecalcEnabled; virtual;

//...

procedure RecalcHasEffect; virtual;

//...

function MakeScreenshot: TBitmap;

// Bitmap

procedure ShowCaretProc;
www.DelphiXEbbs.com

//
194

Delphi XE2 FireMonkey


procedure SetCaretPos(...);

//

procedure SetCaretSize(...);

//

procedure SetCaretColor(...);

//

procedure HideCaret;

//

procedure BeginUpdate; virtual; //


procedure EndUpdate; virtual;

//

procedure Realign; virtual;

//

procedure ApplyEffect;

//

procedure Painting; virtual;

//DoPaint

procedure DoPaint; virtual;

//

procedure AfterPaint; virtual;

//DoPaint

procedure UpdateEffects;

//

procedure SetFocus;

//

procedure PaintTo(...);

// Canvas

procedure Repaint;

//

procedure InvalidateRect(...);
procedure Lock;

//
//

property AbsoluteMatrix: TMatrix ...;

//

property AbsoluteOpacity: Single ...;

//

property AbsoluteWidth: Single ...;

//

property AbsoluteHeight: Single ...;

//

property AbsoluteScale: TPointF ...;

//

www.DelphiXEbbs.com

195

Delphi XE2 FireMonkey


//;

property AbsoluteEnabled: Boolean ...;

property HasEffect: Boolean ...;

//

property HasDisablePaintEffect: Boolean ...; //?


property HasAfterPaintEffect: Boolean ...;

//?

property ChildrenRect: TRectF ...;

//

property InvertAbsoluteMatrix: TMatrix ...;

//

property InPaintTo: Boolean ...;

//?

property LocalRect: TRectF ...;

//

property AbsoluteRect: TRectF ...;

//

property UpdateRect: TRectF ...;

//

property BoundsRect: TRectF ...;

//;

, (0,0,Width,Height)
property ParentedRect: TRectF ...;

//

property ParentedVisible: Boolean ...;

//

property ClipRect: TRectF ...;

//

property Canvas: TCanvas ...;

//

property Scene: IScene ...;

//

property AutoCapture: Boolean ...;

// MouseDown

property CanFocus: Boolean ...;


property DisableFocusEffect: Boolean ...;

//
//

property DisableDefaultAlign: Boolean ...; //


property TabOrder: TTabOrder ...;
www.DelphiXEbbs.com

//Tab
196

Delphi XE2 FireMonkey


published
property IsMouseOver: Boolean ...;

//

property IsDragOver: Boolean ...;

//

property IsFocused: Boolean ...;

//; , SetFo

cus()
property IsVisible: Boolean ...;

//; Visible,

property Align: TAlignLayout ...;

//

property Cursor: TCursor ...;

//

property DragMode: TDragMode ...;

//

property EnableDragHighlight: Boolean ...; //


property Enabled: Boolean ...;

//

property Position: TPosition ...;

//

property RotationAngle: Single ...;

//

property RotationCenter: TPosition ...;

//

property Locked: Boolean ...;

//; Lock()

property Width: Single ...;

//

property Height: Single ...;

//

property Margins: TBounds ...;

//

property Padding: TBounds ...;

//

property Opacity: Single ...;

//: 0..1

property ClipChildren: Boolean ...; //


property ClipParent: Boolean ...;

//?

property HitTest: Boolean ...;

// Hint

www.DelphiXEbbs.com

197

Delphi XE2 FireMonkey


property CanClip: Boolean ...;

//

property PopupMenu: TCustomPopupMenu ...;

//

property Scale: TPosition ...;

//

property Visible: Boolean ...;

//

property DesignVisible: Boolean ...;

//

property OnDragEnter: TDragEnterEvent ...;

//

property OnDragLeave: TNotifyEvent ...;

//

property OnDragOver: TDragOverEvent ...;

//

property OnDragDrop: TDragDropEvent ...;

//

property OnDragEnd: TNotifyEvent ...;

//

property OnKeyDown: TKeyEvent ...;

//

property OnKeyUp: TKeyEvent ...;

//

property OnClick: TNotifyEvent ...;

//

property OnDblClick: TNotifyEvent ...;

//

property OnCanFocus: TCanFocusEvent ...;

//SetFocus()

property OnEnter: TNotifyEvent ...;

//

property OnExit: TNotifyEvent ...;

//

property OnMouseDown: TMouseEvent ...;

//

property OnMouseMove: TMouseMoveEvent ...;

//

property OnMouseUp: TMouseEvent ...;

//

property OnMouseWheel: TMouseWheelEvent ...;

//()

property OnMouseEnter: TNotifyEvent ...;

//

www.DelphiXEbbs.com

198

Delphi XE2 FireMonkey


property OnMouseLeave: TNotifyEvent ...;

//

property OnPainting: TOnPaintEvent ...;

//

property OnPaint: TOnPaintEvent ...;

//

property OnResize: TNotifyEvent ...;

//

property OnApplyStyleLookup: TNotifyEvent ...; //


end;

Delphi XE2 FireMonkey (38) - : TPopupMenu TMenuItem


TMenuBarTMainMenu
: TMenuBarTPopupMenuTMainMenu; TMenuItem;
TMenuItem .
TMainMenu ; TMenuBar UseOSMenu .

PopupMenu .

, PopupMenu ;
TPanel TRectangle:

procedure TForm1.FormCreate(Sender: TObject);


begin
Panel1.Align := TAlignLayout.alClient;
Panel1.StyleLookup := StyleLookup;
Panel1.PopupMenu := PopupMenu1;
end;

TPopupMenu Popup() :

www.DelphiXEbbs.com

199

Delphi XE2 FireMonkey


procedure TForm1.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Single);
var
pt: TPointF;
begin
inherited;
if Button = TMouseButton.mbRight then
begin
pt := PointF(x,y);
pt := ClientToScreen(pt);
PopupMenu1.Popup(pt.X, pt.Y);
end;
end;

Popup() ( TRectangle):

procedure TForm1.Rectangle1MouseDown(Sender: TObject; Button: TMous


eButton; Shift: TShiftState; X, Y: Single);
var
pt: TPointF;
begin
if Button = TMouseButton.mbRight then
begin
pt := PointF(x,y);
pt := TControl(Sender).LocalToAbsolute(pt);
pt := ClientToScreen(pt);
PopupMenu1.Popup(pt.X, pt.Y);
end;
end;

www.DelphiXEbbs.com

200

Delphi XE2 FireMonkey


TPopupMenu , TMenuItem .

Rectangle1PopupMenu1.

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item1';
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item2';
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := '-';
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item3';
www.DelphiXEbbs.com

201

Delphi XE2 FireMonkey


end;
end;

procedure TForm1.FormCreate(Sender: TObject);


var
item: TMenuItem;
begin
Rectangle1.PopupMenu := PopupMenu1;
item := TMenuItem.Create(Self);
item.Parent := PopupMenu1;
item.Text := 'Item1';
with TMenuItem.Create(Self) do
begin
Parent := item;
Text := 'Item1_1';
end;
with TMenuItem.Create(Self) do
begin
Parent := item;
Text := 'Itme1_2';
end;
with TMenuItem.Create(Self) do
begin
Parent := PopupMenu1;
Text := 'Item2';
end;
end;
www.DelphiXEbbs.com

202

Delphi XE2 FireMonkey

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item1';
ShortCut := scCtrl or Byte('A'); //Ctrl + A
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item2';
ShortCut := scShift or scCtrl or scAlt or Ord('A'); //Shift + Ctr
l + Alt + A
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := '-';
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item3';
www.DelphiXEbbs.com

203

Delphi XE2 FireMonkey


ShortCut := 112; //F1
end;
end;

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item1';
AutoCheck := True;
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item2';
AutoCheck := True;
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := '-';
end;
with TMenuItem.Create(PopupMenu1) do
begin
www.DelphiXEbbs.com

204

Delphi XE2 FireMonkey


Parent := PopupMenu1;
Text := 'Item3';
AutoCheck := True;
end;
end;

():

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item1';
AutoCheck := True;
RadioItem := True;
GroupIndex := 1;
IsChecked := True;
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item2';
AutoCheck := True;
RadioItem := True;
GroupIndex := 1;
end;
with TMenuItem.Create(PopupMenu1) do
www.DelphiXEbbs.com

205

Delphi XE2 FireMonkey


begin
Parent := PopupMenu1;
Text := '-';
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item3';
AutoCheck := True;
RadioItem := True;
GroupIndex := 2;
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item4';
AutoCheck := True;
RadioItem := True;
GroupIndex := 2;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
www.DelphiXEbbs.com

206

Delphi XE2 FireMonkey


Text := 'Item1';
Font.Style := [TFontStyle.fsBold, TFontStyle.fsItalic];
end;
end;

procedure TForm1.FormCreate(Sender: TObject);


begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(Self) do
begin
Parent := PopupMenu1;
Text := 'Item1';
Bitmap.LoadFromFile('c:\temp\test.png');
end;
end;

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Menus, FMX.O
bjects;
www.DelphiXEbbs.com

207

Delphi XE2 FireMonkey


type
TForm1 = class(TForm)
Rectangle1: TRectangle;
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure ItemOnClick(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
begin
Rectangle1.PopupMenu := PopupMenu1;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item1';
OnClick := ItemOnClick;
end;
with TMenuItem.Create(PopupMenu1) do
begin
Parent := PopupMenu1;
Text := 'Item2';
OnClick := ItemOnClick;
end;
end;
www.DelphiXEbbs.com

208

Delphi XE2 FireMonkey


procedure TForm1.ItemOnClick(Sender: TObject);
begin
ShowMessage(TTextControl(Sender).Text);
end;
end.

Delphi XE2 FireMonkey (39) - : TScrollBox TVertScrollBox


TFramedScrollBoxTFramedVertScrollBox
TScrollBox (TMemoTListBoxTStringGridTTreeViewTImageViewer ),
.

TVertScrollBox TScrollBox .

TFramedScrollBoxTFramedVertScrollBox , .

{ TScrollBox }
public
constructor Create(...); override;

//

destructor Destroy; override;

//

procedure AddObject(...); override;


procedure Sort(...); override;

//
//

procedure MouseDown(...); override;

//

procedure MouseMove(...); override;

//

procedure MouseUp(...); override;

//

procedure MouseWheel(...); override; //


procedure Realign; override;
procedure Centre;
www.DelphiXEbbs.com

//
//
209

Delphi XE2 FireMonkey


procedure ScrollTo(...);

//

procedure InViewRect(...);

//

function ClientWidth: Single;

//

function ClientHeight: Single;

//

property HScrollBar: TScrollBar ...; //


property VScrollBar: TScrollBar ...; //
published
property AutoHide: Boolean ...;

//

; True
property Animated: Boolean ...;

//; Tru

e
property DisableMouseWheel: Boolean ...;

//;

False,
property MouseTracking: Boolean ...;

//(

, ); False
property ShowScrollBars: Boolean ...;

//; True

property ShowSizeGrip: Boolean ...;

// Grip(

); False
property UseSmallScrollBars: Boolean ...; //
end;

www.DelphiXEbbs.com

210

Delphi XE2 FireMonkey


uses FMX.Layouts, FMX.Objects;
var
ScrollBox1: TScrollBox;
Rectangle1: TRectangle;
procedure TForm1.FormCreate(Sender: TObject);
begin
ScrollBox1 := TScrollBox.Create(Self);
ScrollBox1.Parent := Self;
ScrollBox1.Align := TAlignLayout.alClient;
ScrollBox1.MouseTracking := True;
Rectangle1 := TRectangle.Create(Self);
Rectangle1.Parent := ScrollBox1;
Rectangle1.SetBounds(100, 100, ClientWidth*2, ClientHeight*2);
end;

Delphi XE2 FireMonkey (40) - : TMemo


:

1 TScrollBox , :

Memo1.UseSmallScrollBars := True;
2, (UnDo).

3 TCaretPosition ,
ComposeCaretPos().

TCaretPosition = record
Line, Pos: Integer;
end;
www.DelphiXEbbs.com

211

Delphi XE2 FireMonkey


4 CharCase .

Memo1.CharCase := TEditCharCase.ecUpperCase;
5 AutoSelect .

6 Lines ; UnwrapLines .

Memo1.CharCase := TEditCharCase.ecUpperCase;
7 InsertAfter()DeleteFrom() .

{ TMemo }
public
constructor Create(...); override; //
destructor Destroy; override;

//

procedure CopyToClipboard;

//

procedure PasteFromClipboard;

//

procedure CutToClipboard;

//

procedure ClearSelection;

//

procedure SelectAll;

//

procedure GoToTextEnd;

//

procedure GoToTextBegin;

//

procedure GotoLineEnd;

//

procedure GoToLineBegin;

//

function GetPositionPoint(...): TPointF;


procedure UnDo;
procedure InsertAfter(...);
www.DelphiXEbbs.com

//
//
//
212

Delphi XE2 FireMonkey


procedure DeleteFrom(...);

//

function TextPosToPos(...): TCaretPosition; //

//TextPosToPos()

function PosToTextPos(...): Integer;

property SelStart: Integer ...;

//

property SelLength: Integer ...;

//

property SelText: string ...;

//

property CaretPosition: TCaretPosition ...; //


property LineWidth[LineNum: Integer]: Single ...; //
property UnwrapLines: TStrings ...;

//;

WordWrap = False Lines


property FontFill: TBrush ...;

//

property SelectionFill: TBrush ...;

//

published
property Cursor default crIBeam;

//

property CanFocus default True;

//

property DisableFocusEffect;

//

property TabOrder;

//Tab

property AutoSelect: Boolean ...;

//

property CharCase: TEditCharCase ...;

//

property Enabled;
property HideSelection: Boolean ...;
property Lines: TStrings ...;
www.DelphiXEbbs.com

//
//?
//
213

Delphi XE2 FireMonkey


property MaxLength: Integer ...;

//

property ReadOnly: Boolean ...;

//

property OnChange: TNotifyEvent ...;

//

property OnChangeTracking: TNotifyEvent ...; // OnChange

property WordWrap: Boolean ...;

//

property Font: TFont ...;

//

property Text: string ...;

//

property TextAlign: TTextAlign ...;


property StyleLookup;

//
//

end;

Delphi XE2 FireMonkey (41) - : TListBox


TScrollBox -> TCustomListBox -> TListBox; TListBoxItem .

TListBox TCustomListBox .

:
1(: ShowCheckboxesTListBoxItem.IsChecked)
2()
3TListBoxItem .

{ TCustomListBox }
public
constructor Create(...); override;
www.DelphiXEbbs.com

//
214

Delphi XE2 FireMonkey


destructor Destroy; override;

//

procedure Assign(...); override;

//

procedure Clear; virtual;

//

function DragChange(...): Boolean; dynamic; // OnDragChange

procedure SelectAll;

//

procedure ClearSelection;

//

procedure SelectRange(...);

//

function ItemByPoint(...): TListBoxItem;

//

function ItemByIndex(...): TListBoxItem;

//

procedure Exchange(...);

//

procedure AddObject(...); override;

//

procedure RemoveObject(...); override;

//

procedure Sort(...); override;

//

property Count: Integer ...;

//

property Selected: TListBoxItem ...;


property Items: TStrings ...;

//
//

property ListItems[Index: Integer]: TListBoxItem ...; //

property ItemIndex: Integer ...;

//

end;
{ TListBox }
published
property StyleLookup;

//

property AllowDrag;

//

www.DelphiXEbbs.com

215

Delphi XE2 FireMonkey


property CanFocus;
property DisableFocusEffect;
property TabOrder;

//
//
//

property AlternatingRowBackground; //
property Columns;
property HideSelectionUnfocused;

//; 1
//

property Items;

//

property ItemIndex;

//

property ItemWidth;

//

property ItemHeight;

//

property ListStyle;

//; TListStyle = (lsVerti

cal, lsHorizontal);
property MultiSelect;

//; True , Ct

rl
property Sorted;

//

property ShowCheckboxes;

//; False

property BindingSource;

//

property OnChange;

//

property OnChangeCheck;

//

property OnCompare;

//

property OnDragChange;

//

end;
{ TListBoxItem }
public
constructor Create(...); override; //
property Data: TObject ...;
www.DelphiXEbbs.com

//
216

Delphi XE2 FireMonkey


property Index: Integer ...;

//

published
property IsChecked: Boolean ...;

//

property IsSelected: Boolean ...;

//

property AutoTranslate ...;

//

property Font;
property StyleLookup;
property Text;

//
//
//

property TextAlign ...;

//

property WordWrap;

//

end;

procedure TForm1.FormCreate(Sender: TObject);


var
i: Integer;
begin
ListBox1.Align := TAlignLayout.alLeft;
ListBox1.ShowCheckboxes := True;
ListBox1.AlternatingRowBackground := True;
for i := 0 to 9 do
begin
ListBox1.Items.Add('Itme' + IntToStr(i));
ListBox1.ListItems[i].IsChecked := Odd(i);
end;
end;

Delphi XE2 FireMonkey (42) - : TComboBoxTComboEdit


www.DelphiXEbbs.com

217

Delphi XE2 FireMonkey


TListBox TComboListBoxTComboEditListBox;
TComboBoxTComboEdit , , TList
Box.

TComboBox TListBox, TComboEdit Selected ;


TComboEdit TCustomEdit , TEdit , TComboBox Text .

DropDownCount //
ItemHeight

//

ItemIndex

//

Items

//

Count

//

procedure TForm1.FormCreate(Sender: TObject);


var
i: Integer;
begin
{ ComboBox1 }
for i := 0 to 9 do
ComboBox1.Items.Add(Format('Item_%d', [i]));
with ComboBox1 do
begin
ItemIndex := 0;
DropDownCount := 5;
ListBox.UseSmallScrollBars := True;

www.DelphiXEbbs.com

218

Delphi XE2 FireMonkey


TListBox(ListBox).AlternatingRowBackground := True; //
, AlternatingRowBackground
end;
{ ComboEdit1 }
ComboEdit1.Items.Assign(ComboBox1.Items);
with ComboEdit1 do
begin
ItemIndex := 0;
DropDownCount := 5;
ListBox.UseSmallScrollBars := True;
TListBox(ListBox).AlternatingRowBackground := True;
end;
//

ComboEdit1.Text := 'Text';

end;

Delphi XE2 FireMonkey (43) - : TStringGridTGrid


TStringGridTGrid TCustomGrid ; :
1: TStringColumnTColumn;
2TStringGrid TGrid Cells[] .

TGrid Cells[] , ; :
(Grid1.Columns[Grid1.ColumnIndex].CellControlByRow(Grid1.Selected) as TTextCell).Tex
t

TStringGrid :

{ StringGrid1, }
www.DelphiXEbbs.com

219

Delphi XE2 FireMonkey


procedure TForm1.FormCreate(Sender: TObject);
var
i,c,r: Integer;
begin
StringGrid1.AlternatingRowBackground := True;
StringGrid1.UseSmallScrollBars := True;
for i := 0 to 5 do //
begin
with TStringColumn.Create(Self) do
begin
Parent := StringGrid1;
Width := StringGrid1.ClientWidth / 6;
end;
end;
StringGrid1.RowCount := 20;
for c := 0 to StringGrid1.ColumnCount - 1 do
for r := 0 to StringGrid1.RowCount - 1 do
StringGrid1.Cells[c, r] := Format('%d,%d', [c, r]);
end;

{ }
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(StringGrid1.Cells[StringGrid1.ColumnIndex, StringGrid
1.Selected]);
end;

{ TCustomGrid }
public
www.DelphiXEbbs.com

220

Delphi XE2 FireMonkey


constructor Create(...); override;
destructor Destroy; override;

//
//

function ColumnByIndex(...): TColumn;

//

function ColumnByPoint(...): TColumn;

//

function RowByPoint(...): Integer;

//

procedure AddObject(...); override;

//

property TopRow: Integer ...;

//

property VisibleRows: Integer ...;

//

property ColumnCount: Integer ...;

//()

property ColumnIndex: Integer ...;

//

property Columns[Index: Integer]: TColumn ...; //

property RowCount: Integer ...;

//()

property Selected: Integer ...;

//

property OnGetValue: TOnGetValue ...;

//

property OnSetValue: TOnSetValue ...;

//

published
property StyleLookup;

//

property AlternatingRowBackground: Boolean ...; //;


False
property CanFocus default True;

//

property DisableFocusEffect default True; //


property RowHeight: Single ...;
property ShowSelectedCell: Boolean ...;

//
//;

True
www.DelphiXEbbs.com

221

Delphi XE2 FireMonkey


property ShowVertLines: Boolean ...;

//

property ShowHorzLines: Boolean ...;

//

property ShowHeader: Boolean ...;

//

property ReadOnly: Boolean ...;

//; False

property TabOrder;

//

property OnEdititingDone: TOnEdititingDone ...; //


end;
{ TGrid }
TGrid = class(TCustomGrid)
published
property RowCount;

//

property OnGetValue; //
property OnSetValue; //
end;
{ TStringGrid }
public
property Cells[ACol, ARow: Integer]: string ...; //
published
property RowCount;

//

end;

Delphi XE2 FireMonkey (44) - : TTreeViewTTreeViewItem


TScrollBox -> TCustomTreeView -> TTreeView TTreeViewItem.

, TTreeView, OnChange :

www.DelphiXEbbs.com

222

Delphi XE2 FireMonkey


unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Layouts, FMX.
TreeView;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
procedure FormCreate(Sender: TObject);
procedure TreeView1Change(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
var
item: TTreeViewItem;
i: Integer;
begin
TreeView1.Align := TAlignLayout.alLeft;
TreeView1.UseSmallScrollBars := True;
TreeView1.AlternatingRowBackground := True;
TreeView1.ShowCheckboxes := True;
www.DelphiXEbbs.com

223

Delphi XE2 FireMonkey

item := TTreeViewItem.Create(Self);
item.Parent := TreeView1;
item.Text := 'Item1';
item := TTreeViewItem.Create(Self);
item.Parent := TreeView1;
item.Text := 'Item2';
for i := 0 to 19 do
with TTreeViewItem.Create(Self) do
begin
Parent := item;
Text := item.Text + '_' + IntToStr(i+1);
IsChecked := Odd(i);
end;
item.IsExpanded := True;
item := TTreeViewItem.Create(Self);
item.Parent := TreeView1;
item.Text := 'Item3';
end;
procedure TForm1.TreeView1Change(Sender: TObject);
var
item: TTreeViewItem;
begin
item := TreeView1.Selected;
if item <> nil then
begin
ShowMessageFmt(
'TreeView1.GlobalCount: %d'#13#10 +
'TreeView1.Count: %d'#13#10 +
'TTreeViewItem.Count: %d'#13#10 +
'TTreeViewItem.Level: %d'#13#10 +
www.DelphiXEbbs.com

224

Delphi XE2 FireMonkey


'TTreeViewItem.GlobalIndex: %d'#13#10 +
'TTreeViewItem.Index: %d'#13#10
, [TreeView1.GlobalCount, TreeView1.Count, item.Count, item.Le
vel, item.GlobalIndex, item.Index]
);
end;
end;
end.

{ TCustomTreeView }
public
constructor Create(...); override; //
destructor Destroy; override;

//

procedure EndUpdate; override;

//

procedure Clear;

//

procedure ExpandAll;

//

procedure CollapseAll;

//

function ItemByText(...): TTreeViewItem;

//

function ItemByPoint(...): TTreeViewItem;

//

function ItemByIndex(...): TTreeViewItem;

//

function ItemByGlobalIndex(...): TTreeViewItem; //


procedure AddObject(...); override;

//

procedure RemoveObject(...); override; //


procedure MouseDown(...); override;

//

procedure MouseMove(...); override;

//

www.DelphiXEbbs.com

225

Delphi XE2 FireMonkey


procedure MouseUp(...); override;

//

procedure KeyDown(...); override;

//

procedure KeyUp(...); override;

//

procedure DragOver(...); override;

//

procedure DragDrop(...); override;

//

property Count: Integer ...;

//

property GlobalCount: Integer ...;

//

property CountExpanded: Integer ...;

//???

property Selected: TTreeViewItem ...;

//

property Items[Index: Integer]: TTreeViewItem ...;


property AllowDrag: Boolean ...;

//
//

property AlternatingRowBackground: Boolean ...;

//

property ItemHeight: Single ...;

//

property HideSelectionUnfocused: Boolean ...;

//

property MultiSelect: Boolean ...;

//

property ShowCheckboxes: Boolean ...;

//

property Sorted: Boolean ...;

//

property OnChange: TNotifyEvent ...;

//

property OnChangeCheck: TNotifyEvent ...;

//

property OnCompare: TOnCompareTreeViewItemEvent ...; //


property OnDragChange: TOnTreeViewDragChange ...;

//

end;
{ TTreeView }
published
property StyleLookup;
property CanFocus default True;
www.DelphiXEbbs.com

//
//
226

Delphi XE2 FireMonkey


property DisableFocusEffect;

//

property TabOrder;

//

property AllowDrag default False;

//

property AlternatingRowBackground default False; //


property ItemHeight;

//

property HideSelectionUnfocused default False;

//

property MultiSelect default False;

//

property ShowCheckboxes default False;

//

property Sorted default False;

//

property OnChange;

//

property OnChangeCheck;

//

property OnCompare;

//

property OnDragChange;

//

end;
{ TTreeViewItem }
public
constructor Create(...); override;
procedure Paint; override;

//
//

procedure AddObject(...); override;

//

procedure RemoveObject(...); override;

//

procedure Sort(...); override;

//

function ItemByPoint(...): TTreeViewItem; //


function ItemByIndex(...): TTreeViewItem; //
property Count: Integer ...;

//

property GlobalIndex: Integer ...;

//

function TreeView: TCustomTreeView;

// TreeView

function Level: Integer;


function ParentItem: TTreeViewItem;

//
//

property Items[Index: Integer]: TTreeViewItem ...; //


www.DelphiXEbbs.com

227

Delphi XE2 FireMonkey


published
property IsChecked: Boolean ...;

//

property IsExpanded: Boolean ...;

//

property IsSelected: Boolean ...;

//

property AutoTranslate default True; //


property Font;
property StyleLookup;
property Text;

//
//
//

property TextAlign default TTextAlign.taLeading; //


end;

Delphi XE2 FireMonkey (45) -


FMX , : TExpanderTArcDialTComboTrackBarTPathLabel ,
.

FMX : , ; ,
!

:
1TCanvasTBrushTApplication;
2FMX GDI+D2DDirectX;
3FMX 3D;
4XE2 ( TZipFile , ).

, .

; FMX , :
TMemo .

www.DelphiXEbbs.com

228

Delphi XE2 FireMonkey

unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, Sy
stem.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Layouts, FMX.
Memo;
type
TForm1 = class(TForm)
Memo1: TMemo; // Memo1
private
public
{ }
procedure DragOver(const Data: TDragObject; const Point: TPointF;
var Accept: Boolean); override;
procedure DragDrop(const Data: TDragObject; const Point: TPoint
F); override;
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
{ TForm1 }

www.DelphiXEbbs.com

229

Delphi XE2 FireMonkey


procedure TForm1.DragOver(const Data: TDragObject; const Point: TPo
intF; var Accept: Boolean);
begin
inherited;
{ , *.txt , Accept := True DragD
rop }
Accept := (Length(Data.Files) > 0) and (CompareText(ExtractFileExt
(Data.Files[0]), '.txt') = 0);
end;
procedure TForm1.DragDrop(const Data: TDragObject; const Point: TPo
intF);
begin
inherited;
Memo1.Lines.LoadFromFile(Data.Files[0]);
end;
end.

<>

www.DelphiXEbbs.com

230

You might also like