Hide Comments
Hide Comments

Comments (0)

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

expandingInheritance Hierarchy

TLayout
  FMX.RS.SVGCtrls.TRSSVGPanel
 

expandingSyntax

Delphi

type
  TRSSVGPanel = class(TLayout, ISVGViewer)
  end;
 

expandingConstructors

 

Name

Description

public constructor

Create(TComponent)

Initializes a new instance of the TRSSVGPanel class.

public destructor

Destroy

Represents the destructor of the TRSSVGPanel class.

Top

expandingProperties

 

Name

Description

published property

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

published property

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.

published property

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 .

published property

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

expandingMethods

 

Name

Description

public method

ClearSVGDocument

Clears the SVGDocument property without deleting the SVG elements

protected method

DoCallback(TSVGElement,TControl)

Represents method DoCallback(TSVGElement,TControl).

protected method

DoSVGChanged(TObject)

Represents method DoSVGChanged(TObject).

public method

FindControl(String)

Returns the child (or grandchild, or grandchild, etc) control of the panel that has a SVGID property equal to the parameter

public method

GenerateControls

Regenerates the FMX controls for the panel

protected method

GetSVGRoot

Represents method GetSVGRoot.

protected method

Loaded

Represents method Loaded.

protected method

Notification(TComponent,TOperation)

Represents method Notification(TComponent,TOperation).

protected method

Resize

Represents method Resize.

Top

expandingEvents

 

Name

Description

published event

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

expandingRemarks

alert_cautionImportant 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.

expandingExamples

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) SelectComponentVcl
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)
SelectSVGDocFMXPanel
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 CreateControlsFMX
Edit generated controls like any other FMX controls. Here we have added a TShadowEffect to one of the characters and changed its color

alert_cautionWarning

Note that if you reset TRSSVGPanel.SVGDocument to the SVG document, you will lose your controls

EditPanelControlsFMX

expandingSee Also

Reference

Comments (0)

RiverSoftAVG SVG Component Library (RSCL) © 2013-2015, Thomas G. Grubb