文档章节

Delphi XE2 之 FireMonkey 入门(2)

涂孟超
 涂孟超
发布于 2014/09/26 15:38
字数 1646
阅读 28
收藏 0
点赞 0
评论 0

FireMonkey 的控件都是自己绘制的(而不是基于系统组件), 我想它们应该是基于一些基本图形; 就从基本图形开始吧.

FMX.Objects 单元给出的类:
TShape //基本图形的基类
TLine
TRectangle
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 SetCornerType default TCornerType.ctRound;
    property Sides: TSides read FSides write SetSides stored IsSidesStored;

{ 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 SetStrokeThickness stored IsStrokeThicknessStored;
    property StrokeCap: TStrokeCap read FStrokeCap write SetStrokeCap default TStrokeCap.scFlat;
    property StrokeDash: TStrokeDash read FStrokeDash write SetStrokeDash default TStrokeDash.sdSolid;
    property StrokeJoin: TStrokeJoin read FStrokeJoin write SetStrokeJoin 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;
    { 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;
    procedure PaintTo(const ACanvas: TCanvas; const ARect: TRectF; const 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 GetAbsoluteHasDisablePaintEffect;
    property HasAfterPaintEffect: Boolean read GetAbsoluteHasAfterPaintEffect;
    property ChildrenRect: TRectF read GetChildrenRect;
    property InvertAbsoluteMatrix: TMatrix read GetInvertAbsoluteMatrix;
    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 SetBoundsRect;
    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 FAutoCapture default False;
    property CanFocus: Boolean read FCanFocus write FCanFocus default False;
    property DisableFocusEffect: Boolean read FDisableFocusEffect write 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 SetRotationAngle;
    property RotationCenter: TPosition read FRotationCenter write FRotationCenter;
    property Locked: Boolean read FLocked write SetLocked default False;
    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;
    property Opacity: Single read FOpacity write SetOpacity stored IsOpacityStored;
    property ClipChildren: Boolean read FClipChildren write SetClipChildren 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 True;
    property PopupMenu: TCustomPopupMenu read FPopupMenu write SetPopupMenu;
    property Scale: TPosition read FScale write FScale;
    property Visible: Boolean read FVisible write SetVisible default True;
    property DesignVisible: Boolean read FDesignVisible write SetDesignVisible default True;
    property OnDragEnter: TDragEnterEvent read FOnDragEnter write FOnDragEnter;
    property OnDragLeave: TNotifyEvent read FOnDragLeave write FOnDragLeave;
    property OnDragOver: TDragOverEvent read FOnDragOver write FOnDragOver;
    property OnDragDrop: TDragDropEvent read FOnDragDrop write FOnDragDrop;
    property OnDragEnd: TNotifyEvent read FOnDragEnd write FOnDragEnd;
    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 FOnDblClick;
    property OnCanFocus: TCanFocusEvent read FOnCanFocus write FOnCanFocus;
    property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
    property OnExit: TNotifyEvent read FOnExit write FOnExit;
    property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
    property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
    property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;
    property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;
    property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
    property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
    property OnPainting: TOnPaintEvent read FOnPainting write FOnPainting;
    property OnPaint: TOnPaintEvent read FOnPaint write FOnPaint;
    property OnResize: TNotifyEvent read FOnResize write FOnResize;
    property OnApplyStyleLookup: TNotifyEvent read FOnApplyStyleLookup 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 = True);
    function ItemClass: string; virtual;
    { clone }
    function Clone(const AOwner: TComponent): TFmxObject;
    procedure CloneChildFromStream(AStream: TStream);
    { childs }
    procedure AddObject(AObject: TFmxObject); virtual;
    procedure InsertObject(Index: Integer; AObject: TFmxObject); virtual;
    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: Boolean);
    { 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): TFmxObject; virtual;
    procedure UpdateStyle; virtual;
    { animations }
    procedure StartAnimation(const AName: string); virtual;
    procedure StopAnimation(const AName: string); virtual;
    procedure StartTriggerAnimation(AInstance: TFmxObject; const ATrigger: string); virtual;
    procedure StartTriggerAnimationWait(AInstance: TFmxObject; const ATrigger: string); virtual;
    procedure StopTriggerAnimation(AInstance: TFmxObject); virtual;
    procedure ApplyTriggerEffect(AInstance: TFmxObject; const ATrigger: string); virtual;
    { animation property }
    procedure AnimateFloat(const APropertyName: string; const NewValue: Single; Duration: ...);
    procedure AnimateColor(const APropertyName: string; NewValue: TAlphaColor; Duration: ...);
    procedure AnimateFloatDelay(const APropertyName: string; const NewValue: Single; Duration: ...);
    procedure AnimateFloatWait(const APropertyName: string; const NewValue: 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 write SetBinding;
    property Parent: TFmxObject read FParent write SetParent;
    property Index: Integer read GetIndex write SetIndex;
  published
    property BindingName: string read FBindingName write SetBindingName;
    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: Pointer): HResult; override;
    function UpdateAction(Action: TBasicAction): Boolean; virtual;
    function IsImplementorOf(const I: IInterface): Boolean;
    function ReferenceInterface(const I: IInterface; Operation: TOperation): Boolean;
    property ComObject: IUnknown read GetComObject;
    property Components[Index: Integer]: TComponent read GetComponent;
    property ComponentCount: Integer read GetComponentCount;
    property ComponentIndex: Integer read GetComponentIndex write SetComponentIndex;
    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 FVCLComObject;
    property Observers: TObservers read GetObservers;
  published
    property Name: TComponentName read FName write SetName stored False;
    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;
    class function MethodAddress(const Name: ShortString): Pointer; overload;
    class function MethodAddress(const Name: string): Pointer; overload;
    class function MethodName(Address: Pointer): string;
    class function QualifiedClassName: string;
    function FieldAddress(const Name: ShortString): Pointer; overload;
    function FieldAddress(const Name: string): Pointer; overload;
    function GetInterface(const IID: TGUID; out Obj): Boolean;
    class function GetInterfaceEntry(const IID: TGUID): PInterfaceEntry;
    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: Pointer): 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;


慢慢消化...

© 著作权归作者所有

共有 人打赏支持
涂孟超
粉丝 12
博文 2004
码字总数 14107
作品 0
深圳
程序员
Delphi XE2:这就是我们所期待的Delphi吗?

版权声明:本文为 OSChina.NET 原创编译 转载务必注明出处,并保留链接! 作者:蒂姆.安德森 Delphi是被一些人遗忘了的快速应用程序开发工具,但它与可视组件库相结合,依然是开发Windows本机...

虫虫 ⋅ 2011/10/31 ⋅ 49

PostgreDAC 2.8.0,Delphi的PostgreSQL组件

PostgreDAC 2.8.0 发布了,该版本首次通过 RAD Studio XE2 支持 Mac OS X 系统,大大提升了 FireMonkey 支持,修复了关于 TPSQLMonitor 的 bug。 完整改进记录: [!] FireMonkey and cross p...

红薯 ⋅ 2012/03/20 ⋅ 1

Delphi XE2 新功能:LiveBindings --- 把对象之间的属性绑定起来

Delphi XE2 新功能:LiveBindings --- 把对象之间的属性绑定起来日期:2011年9月9日 作者: 人气:5340 查看:[大字体 中字体 小字体] XE2 有了 FireMonkey 框架,它不同于 VCL ,以往的数据感...

vga ⋅ 2016/08/09 ⋅ 0

Delphi 发展历史

自然人的软件著作权,保护期为自然人终生及其died后50年;软件是合作开发的,截止于最后died的自然人died后第50年的12月31日。法人或者其他组织的软件著作权,保护期为软件首次发表之后50年,...

vga ⋅ 2014/05/13 ⋅ 2

最全面的常用Delphi第三方控件汇总—报表、图表、界面、数据库等

有网友问我常用Delphi第三方控件及功能。我先大概整理一下,以后会在文章里面碰到时再仔细介绍。 报表图表方面: TeeChart Pro 在delphi 的图形显示方面目前唯一的选择,虽然从delphi 3 就随...

Leamontea ⋅ 2012/12/03 ⋅ 2

PostgreSQL的Delphi组件--PostgreDAC

PostgreDAC 是适合 Delphi/C++ Builder 操作 PostgreSQL 数据库的功能非常强大的组件包,允许你创建直连 PostgreSQL 数据库的 Delphi/C++ Builder 应用,无需 BDE 和 ODBC 支持。 使用 Post...

匿名 ⋅ 2012/03/20 ⋅ 0

delphi各个版本编译开关值

delphi各个版本编译开关值 {$IFDEF VER80} - Delphi 1 {$IFDEF VER90} - Delphi 2 {$IFDEF VER100} - Delphi 3 {$IFDEF VER120} - Delphi 4 {$IFDEF VER130} - Delphi 5 {$IFDEF VER140} - D......

伽罗kapple ⋅ 2016/03/01 ⋅ 0

Delphi XE5 for Android 启动无黑屏等待总结

Delphi XE5 for Android 启动无黑屏等待总结 从embarcadero官方技术论坛找了下参考资料,对黑屏处理应该来说有了相应的办法,并且这种办法具有很好的应用价值,因此做了个总结,Delphi XE5 无黑屏...

vga ⋅ 2014/10/07 ⋅ 0

请问delphi XE 和 RAD studio有什么区别呢?

本人不是做delphi的,想了解一下delphi,请问站内好友,Delphi Prism XE2,delphi xe和Rad studio有什么区别呢? 下载哪个版本适合学习?谢谢啦!...

it-达摩 ⋅ 2011/11/22 ⋅ 1

减小Delphi XE 以上版 编译出来的程序体积

减小Delphi XE 以上版 编译出来的程序体积 . 默认Delphi XE, XE2, XE3,XE4,XE5, XE6 ... 编译出来的程序体积很大。 一般用两个方法可以很大程度上减少程序体积。 一、在工程中用编译指令禁用...

vga ⋅ 2014/08/02 ⋅ 2

没有更多内容

加载失败,请刷新页面

加载更多

下一页

JavaScript零基础入门——(八)JavaScript的数组

JavaScript零基础入门——(八)JavaScript的数组 欢迎大家回到我们的JavaScript零基础入门,上一节课我们讲了有关JavaScript正则表达式的相关知识点,便于大家更好的对字符串进行处理。这一...

JandenMa ⋅ 今天 ⋅ 0

sbt网络问题解决方案

转自:http://dblab.xmu.edu.cn/blog/maven-network-problem/ cd ~/.sbt/launchers/0.13.9unzip -q ./sbt-launch.jar 修改 vi sbt/sbt.boot.properties 增加一个oschina库地址: [reposit......

狐狸老侠 ⋅ 今天 ⋅ 0

大数据,必须掌握的10项顶级安全技术

我们看到越来越多的数据泄漏事故、勒索软件和其他类型的网络攻击,这使得安全成为一个热门话题。 去年,企业IT面临的威胁仍然处于非常高的水平,每天都会看到媒体报道大量数据泄漏事故和攻击...

p柯西 ⋅ 今天 ⋅ 0

Linux下安装配置Hadoop2.7.6

前提 安装jdk 下载 wget http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.7.6/hadoop-2.7.6.tar.gz 解压 配置 vim /etc/profile # 配置java环境变量 export JAVA_HOME=/opt/jdk1......

晨猫 ⋅ 今天 ⋅ 0

crontab工具介绍

crontab crontab 是一个用于设置周期性被执行的任务工具。 周期性执行的任务列表称为Cron Table crontab(选项)(参数) -e:编辑该用户的计时器设置; -l:列出该用户的计时器设置; -r:删除该...

Linux学习笔记 ⋅ 今天 ⋅ 0

深入Java多线程——Java内存模型深入(2)

5. final域的内存语义 5.1 final域的重排序规则 1.对于final域,编译器和处理器要遵守两个重排序规则: (1)在构造函数内对一个final域的写入,与随后把这个被构造对象的引用赋值给一个引用...

江左煤郎 ⋅ 今天 ⋅ 0

面试-正向代理和反向代理

面试-正向代理和反向代理 Nginx 是一个高性能的反向代理服务器,但同时也支持正向代理方式的配置。

秋日芒草 ⋅ 今天 ⋅ 0

Spring 依赖注入(DI)

1、Setter方法注入: 通过设置方法注入依赖。这种方法既简单又常用。 类中定义set()方法: public class HelloWorldOutput{ HelloWorld helloWorld; public void setHelloWorld...

霍淇滨 ⋅ 昨天 ⋅ 0

马氏距离与欧氏距离

马氏距离 马氏距离也可以定义为两个服从同一分布并且其协方差矩阵为Σ的随机变量之间的差异程度。 如果协方差矩阵为单位矩阵,那么马氏距离就简化为欧氏距离,如果协方差矩阵为对角阵,则其也...

漫步当下 ⋅ 昨天 ⋅ 0

聊聊spring cloud的RequestRateLimiterGatewayFilter

序 本文主要研究一下spring cloud的RequestRateLimiterGatewayFilter GatewayAutoConfiguration @Configuration@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMi......

go4it ⋅ 昨天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部