unit Execute.AwesomeFMX;
unit Execute.AwesomeFMX;
{
Awesome FMX for XE6 (c)2014 by Paul TOTH
http://www.execute.re
}
interface
uses
System.Classes, System.Types, System.UITypes,
FMX.Controls, FMX.Graphics, FMX.Types;
type
TAwesomeFMX = class(TControl)
public
constructor Create(AOwner: TComponent); override;
procedure Paint; override;
published
property Position;
property Width;
property Height;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Execute.SARL', [TAwesomeFMX]);
end;
{ TAwesomeFMX }
constructor TAwesomeFMX.Create(AOwner: TComponent);
begin
inherited;
Position.X := 20;
Position.Y := 20;
Width := 320;
Height := 160;
end;
procedure TAwesomeFMX.Paint;
var
R: TRectF;
begin
R := LocalRect;
Canvas.Stroke.Color := TAlphaColorRec.Black;
Canvas.Stroke.Thickness := 4;
Canvas.DrawRect(R, 0, 0, [], 1);
Canvas.Font.Family := 'Arial';
Canvas.Font.Style := [TFontStyle.fsBold];
Canvas.Font.Size := 48;
Canvas.Fill.Color := TAlphaColorRec.Black;
R.Right := R.Left + 320;
Canvas.FillText(R, 'FMX'#13'IS'#13'AWESOME', False, 1, [], TTextAlign.Leading);
end;
end.
Needs Canvas.IntersectCliprect before FillText.
ReplyDeleteNo, just remove the line "R.Right := R.Left + 320" :)
ReplyDeleteI'm not sure I understand the point you're making here...? Unless it's that FMX is awesome, in which case, great :)
ReplyDeleteAh, gotcha :)
ReplyDeleteI like it! It's useful, makes a few extra unusual things possible. (I think some of the effects rely on that, for example. I've used it to good effect in my own code too.)