Provides a panel for generating design-time or run-time FMX objects for a SVG. Unlike the TRSSVGImage component, the TRSSVGPanel component does not draw the SVG using canvas operations. Rather, it generates the FMX controls to draw the SVG.
Namespace: FMX.RS.SVGCtrls
TLayout
FMX.RS.SVGCtrls.TRSSVGPanel
|
Delphi
|
type
TRSSVGPanel = class(TLayout, ISVGViewer)
end;
|
|
Name
|
Description
|
|
ScaleOriginal
|
Specifies the scale factor for generating the SVG FMX controls.
Use the ScaleOriginal property to scale the SVG larger or smaller within the TRSSVGThreadImage component. This is useful for controlling the tiling the SVG or zooming in or out of the SVG
|
|
SVGDocument
|
Specifies the SVG document to display in the control. The SVGDocument and SVGRootID properties control exactly which SVG document and which branch of the SVG document hierarchy to display.
|
|
SVGRootID
|
Specifies which node of the SVGDocument to draw as the top- level SVG document.
Use the SVGRootID property to display only a portion of the SVGDocument .
|
|
WrapMode
|
Specifies whether and how to resize, replicate, and position the SVG FMX controls surface.
The WrapMode property should be one of the constants defined in the TSVGImageWrapMode type:
iwOriginal-- generates the SVG with its original dimensions.
iwFit-- best fit (keeping SVG proportions--the ratio between the width and height) for the TRSSVGPanel rectangle. Default.
iwStretch--stretches the SVG to fill the entire rectangle of this TRSSVGPanel component.
iwTile--ignored
iwCenter-- center the SVG inside the TRSSVGPanel component
|
Top
|
|
Name
|
Description
|
|
OnGenerateControl
|
Event for when a FMX control is generated for a SVG element
Use the OnGenerateControl event to modify the FMX control after it has been created and initialized for an SVG element.
|
Top
|
Important Note
|
To create permanent FMX controls for the SVG at design-time, right click the TRSSVGPanel and select "Create FMX Controls..." After the controls are generated, the SVGDocument property will be nil.
|
|
To load and draw a SVG at run-time, create the SVG document and the SVG Panel:
Delphi
|
SVGDoc := TRSFmxSVGDocument.Create(Self);
SVGDoc.Filename := 'c:\MySVG.svg';
SVGPanel := TRSSVGPanel.Create(Self);
SVGPanel.Parent := Self;
SVGPanel.SVGDocument := SVGDoc;
|
At design-time, you would:
• Drop an SVG document component on your form ( RSSVGCtrls|TRSSVGDocument for VCL, TRSFMXSVGDocument for FMX) • Set the TRS[FMX]SVGDocument.Filename property to the SVG file. Alternatively, you can directly paste the SVG into the Lines property (warning: Delphi's TStrings editor will truncate long lines causing problems with some SVG text) • Drop a TRSSVGPanel component on the form • Connect the TRSSVGPanel.SVGDocument to the RSSVGDocument1 (VCL) or
RSFMXSVGDocument1 (FMX)
• Optionally, right click the panel and generate the FMX controls to recreate the SVG. At this point, you could also delete the original SVGDocument as it is not needed anymore • Edit generated controls like any other FMX controls. Here we have added a TShadowEffect to one of the characters and changed its color
Warning
|
Note that if you reset TRSSVGPanel.SVGDocument to the SVG document, you will lose your controls
|
|
|