New to Telerik UI for WinFormsStart a free 30-day trial

Represents a scalable vector graphics (SVG) image that can be rendered at different sizes with high quality.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

C#
[TypeConverter(typeof(SvgImageTypeConverter))]
public class RadSvgImage : MarshalByRefObject, ISerializable, ICloneable, IDisposable

Inheritance: objectMarshalByRefObjectRadSvgImage

Implements: ICloneableIDisposableISerializable

Inherited Members MarshalByRefObject.MemberwiseClone(bool)MarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.CreateObjRef(Type)

Constructors

C#
protected RadSvgImage(SerializationInfo info, StreamingContext context)
Parameters:infoSerializationInfocontextStreamingContext

Properties

Gets or sets a value indicating whether to allow caching of the SVG image. When set to true, the image can be cached to improve performance on subsequent loads.

C#
public static bool AllowCache { get; set; }
Property Value:

true if caching is allowed; otherwise, false.

Document

SvgDocument

Gets or sets the SVG document associated with this instance.

C#
[CLSCompliant(false)]
public SvgDocument Document { get; }

Gets or sets the default height of the SVG image. Note that if you set negative value or null, the default height of the SvgDocument will be returned when accessing the property.

C#
public int Height { get; set; }

Gets or sets the default size of the SVG image. If this property is not modified it takes the value from the SvgDocument.

C#
public Size Size { get; set; }

Gets or sets the default width of the SVG image. Note that if you set negative value or null, the default width of the SvgDocument will be returned when accessing the property.

C#
public int Width { get; set; }

Methods

Clears all cached raster images.

C#
public virtual void ClearCache()

Creates a new instance of the current RadSvgImage by cloning its properties.

C#
public object Clone()
Returns:

object

A new RadSvgImage object that is a copy of the original instance.

Implements: ICloneable.Clone()

Deserializes a string representation of an SVG image into a RadSvgImage object.

C#
public static RadSvgImage Deserialize(string encodedImage)
Parameters:encodedImagestring

The XML string representation containing the SVG image data to be deserialized.

Returns:

RadSvgImage

A RadSvgImage object that represents the deserialized SVG image.

Releases the resources used by the RadSvgImage instance.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Remarks:

This method overrides the Dispose method to clean up resources used by the RadSvgImage. It should be called when the object is no longer needed to free up system resources.

Creates a RadSvgImage from the specified byte array.

C#
public static RadSvgImage FromByteArray(byte[] bytes)
Parameters:bytesbyte[]

A byte array that contains the data for this RadSvgImage.

Returns:

RadSvgImage

The RadSvgImage this method creates.

Creates a RadSvgImage from the specified file.

C#
public static RadSvgImage FromFile(string filename)
Parameters:filenamestring

A string that contains the name of the file from which to create the RadSvgImage.

Returns:

RadSvgImage

The RadSvgImage this method creates.

Creates a RadSvgImage from the specified data stream.

C#
public static RadSvgImage FromStream(Stream stream)
Parameters:streamStream

A Stream that contains the data for this RadSvgImage.

Returns:

RadSvgImage

The RadSvgImage this method creates.

Creates a RadSvgImage from the specified XML string.

C#
public static RadSvgImage FromXml(string xml)
Parameters:xmlstringReturns:

RadSvgImage

Returns a raster Bitmap with the default width and height for the loaded SVG document.

C#
public virtual Bitmap GetRasterImage(bool cache = true)
Parameters:cachebool

Determines whether to cache the raster image. Default value is true.

Returns:

Bitmap

The raster image.

Returns a raster Bitmap by given width and height for the loaded SVG document.

C#
public virtual Bitmap GetRasterImage(int width, int height, bool cache = true)
Parameters:widthint

The width of the raster image.

heightint

The height of the raster image.

cachebool

Determines whether to cache the raster image. Default value is true.

Returns:

Bitmap

The raster image.

Returns a raster Bitmap by given size for the loaded SVG document.

C#
public virtual Bitmap GetRasterImage(Size size, bool cache = true)
Parameters:sizeSize

The size of the SVG document.

cachebool

Determines whether to cache the raster image. Default value is true.

Returns:

Bitmap

The raster image.

Serializes the specified RadSvgImage into a format suitable for storage or transmission.

C#
public static string Serialize(RadSvgImage svgImage)
Parameters:svgImageRadSvgImage

The RadSvgImage instance to be serialized.

Returns:

string

A string that represents the serialized form of the provided RadSvgImage.

Converts the current instance of the RadSvgImage class to its equivalent string representation.

C#
public override string ToString()
Returns:

string

A string that represents the current RadSvgImage object.

Overrides: object.ToString()