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 ResourceHelper

Provides utility methods for loading and manipulating embedded assembly resources.

Inheritance
System.Object
ResourceHelper
Inherited Members
System.Object.ToString()
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 static class ResourceHelper
Remarks

ResourceHelper contains static methods for accessing embedded resources from assemblies, particularly images and cursors that are embedded as manifest resources. It provides safe resource loading with proper exception handling and resource disposal.

Key features include:

  • Safe loading of embedded bitmap images with automatic memory management
  • Cursor creation from embedded cursor resource files
  • Proper exception handling with debug output for troubleshooting
  • Automatic resource stream disposal to prevent memory leaks
  • Assembly-based resource resolution using type information

This class is commonly used throughout Telerik controls for loading embedded images, icons, cursors, and other resources that are compiled into the assembly as manifest resources.

Methods

CursorFromResource(Type, String)

Creates a new cursor from an embedded resource in the assembly containing the specified type.

Declaration
public static Cursor CursorFromResource(Type type, string resourceName)
Parameters
System.Type type

A type from the assembly that contains the embedded resource.

System.String resourceName

The fully qualified name of the embedded cursor resource (including namespace).

Returns
System.Windows.Forms.Cursor

A new System.Windows.Forms.Cursor instance loaded from the embedded resource, or null if the resource could not be found or loaded.

Remarks

This method safely loads a cursor from an embedded manifest resource by:

  1. Obtaining the assembly from the specified type
  2. Opening a stream to the manifest resource
  3. Creating a cursor directly from the stream
  4. Ensuring proper resource disposal regardless of outcome

The resource should be a valid cursor file (.cur) embedded as a manifest resource. The resource name should include the full namespace path, similar to other embedded resources.

Exception handling ensures that any loading errors are logged to debug output for troubleshooting, while maintaining application stability by returning null on failure.

ImageFromResource(Type, String)

Creates a new bitmap image from an embedded resource in the assembly containing the specified type.

Declaration
public static Bitmap ImageFromResource(Type type, string resourceName)
Parameters
System.Type type

A type from the assembly that contains the embedded resource.

System.String resourceName

The fully qualified name of the embedded resource (including namespace).

Returns
System.Drawing.Bitmap

A new System.Drawing.Bitmap instance loaded from the embedded resource, or null if the resource could not be found or loaded.

Remarks

This method safely loads a bitmap image from an embedded manifest resource by:

  1. Obtaining the assembly from the specified type
  2. Opening a stream to the manifest resource
  3. Creating a temporary bitmap from the stream
  4. Creating a new bitmap copy to ensure proper memory management
  5. Disposing of temporary resources and streams

The resource name should include the full namespace path. For example, if an image is in the "Resources" folder of a project with namespace "MyProject", the resource name would be "MyProject.Resources.image.png".

Exception handling ensures that any loading errors are logged to debug output, and all resources are properly disposed of regardless of success or failure.

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.