skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class RadSvgImage

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

Inheritance
System.Object
System.MarshalByRefObject
RadSvgImage
Inherited Members
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.CreateObjRef(System.Type)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll

Syntax

public class RadSvgImage : MarshalByRefObject, ISerializable, ICloneable, IDisposable
Remarks

RadSvgImage provides comprehensive SVG support in Telerik WinControls, allowing vector graphics to be displayed with perfect scaling at any resolution. The class handles SVG document parsing, rendering, and caching for optimal performance.

The image supports automatic caching of rendered bitmaps at different sizes to improve performance when the same SVG is rendered multiple times. It implements serialization and cloning capabilities for design-time support and runtime manipulation.

RadSvgImage is ideal for icons, logos, and other graphics that need to maintain crisp appearance across different DPI settings and zoom levels in modern applications.

Constructors

RadSvgImage(SerializationInfo, StreamingContext)

This constructor is called during the deserialization process. https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.iserializable?view=netframework-2.0

Declaration
protected RadSvgImage(SerializationInfo info, StreamingContext context)
Parameters
System.Runtime.Serialization.SerializationInfo info

System.Runtime.Serialization.StreamingContext context

Properties

AllowCache

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.

Declaration
public static bool AllowCache { get; set; }
Property Value
System.Boolean

true if caching is allowed; otherwise, false.

Document

Gets or sets the SVG document associated with this instance.

Declaration
[CLSCompliant(false)]
public SvgDocument Document { get; }
Property Value
SvgDocument

Height

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.

Declaration
public int Height { get; set; }
Property Value
System.Int32

Size

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

Declaration
public Size Size { get; set; }
Property Value
System.Drawing.Size

Width

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.

Declaration
public int Width { get; set; }
Property Value
System.Int32

Methods

ClearCache()

Clears all cached raster images.

Declaration
public virtual void ClearCache()

Clone()

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

Declaration
public object Clone()
Returns
System.Object

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

Implements
System.ICloneable.Clone()

Deserialize(String)

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

Declaration
public static RadSvgImage Deserialize(string encodedImage)
Parameters
System.String encodedImage

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

Returns
RadSvgImage

A RadSvgImage object that represents the deserialized SVG image.

Dispose()

Releases the resources used by the RadSvgImage instance.

Declaration
public void Dispose()
Implements
System.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.

FromByteArray(Byte[])

Creates a RadSvgImage from the specified byte array.

Declaration
public static RadSvgImage FromByteArray(byte[] bytes)
Parameters
System.Byte[] bytes

A byte array that contains the data for this RadSvgImage.

Returns
RadSvgImage

The RadSvgImage this method creates.

FromFile(String)

Creates a RadSvgImage from the specified file.

Declaration
public static RadSvgImage FromFile(string filename)
Parameters
System.String filename

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

Returns
RadSvgImage

The RadSvgImage this method creates.

FromStream(Stream)

Creates a RadSvgImage from the specified data stream.

Declaration
public static RadSvgImage FromStream(Stream stream)
Parameters
System.IO.Stream stream

A System.IO.Stream that contains the data for this RadSvgImage.

Returns
RadSvgImage

The RadSvgImage this method creates.

FromXml(String)

Creates a RadSvgImage from the specified XML string.

Declaration
public static RadSvgImage FromXml(string xml)
Parameters
System.String xml

Returns
RadSvgImage

GetRasterImage(Boolean)

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

Declaration
public virtual Bitmap GetRasterImage(bool cache = true)
Parameters
System.Boolean cache

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

Returns
System.Drawing.Bitmap

The raster image.

GetRasterImage(Size, Boolean)

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

Declaration
public virtual Bitmap GetRasterImage(Size size, bool cache = true)
Parameters
System.Drawing.Size size

The size of the SVG document.

System.Boolean cache

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

Returns
System.Drawing.Bitmap

The raster image.

GetRasterImage(Int32, Int32, Boolean)

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

Declaration
public virtual Bitmap GetRasterImage(int width, int height, bool cache = true)
Parameters
System.Int32 width

The width of the raster image.

System.Int32 height

The height of the raster image.

System.Boolean cache

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

Returns
System.Drawing.Bitmap

The raster image.

Serialize(RadSvgImage)

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

Declaration
public static string Serialize(RadSvgImage svgImage)
Parameters
RadSvgImage svgImage

The RadSvgImage instance to be serialized.

Returns
System.String

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

ShouldSerializeDocument()

Determines whether the document of the RadSvgImage should be serialized.

Declaration
public bool ShouldSerializeDocument()
Returns
System.Boolean

Returns false as the document should never be serialized.

ToString()

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

Declaration
public override string ToString()
Returns
System.String

A string that represents the current RadSvgImage object.

Overrides
System.Object.ToString()

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
System.Runtime.Serialization.SerializationInfo info

System.Runtime.Serialization.StreamingContext context

Implements
System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

Extension Methods

SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.