Nevron Open Vision Documentation
Resources Overview

Nevron Open Vision uses a tool called Nevron Resource Maker, that converts all the resources you want embedded in your application to a set of C# source code files. The result of running the Nevron Resource Maker is a C# source code file that contains the resource definitions (typically named "NResources.cs") and one or more CS files named "NResourceData1.cs", "NResourceData2.cs", etc., which contain the actual resource data and which should be manually included in your project when generated for the first time.

Creating Resources

The Nevron Resource Maker tool creates a resource container class (for example NResources) that contains references to each embedded resource and exposes the most common resource types as ready to use Nevron objects. You should place each file you want to use as an embedded resource in a subfolder of the resources folder based on their type. The Nevron Resource Maker expects the following directory structure:

Nevron Resource Maker Directory Structure

Each subdirectory has a default inlcude filter, for example the Fonts folder expects TTF files, the Images folder expects BMP, GIF, JPG and PNG files, the Text folder expects files with text content and so on. You can override the include filter for each folder in the XML settings file passed as an argument to the Nevron Resource Maker. Head to the Resource Maker topic for more information about the default include filders for the different resource subfolders and how to override them.

To make it easier for you, Nevron Resource Maker automatically generates static, get only properties of the proper type for the embedded resources in the generated resource container class, which you can access and use directly in your code. The generated static properties has a prefix that matches the resource directory they are placed in, for example each file placed in the Images directory results in a static property of type NImage with a prefix "Image_".

Working with Resources

The Nevron Resource Maker creates a singleton class (usually named NResources), which exposes each of the embedded files through a static, get only property of type based on the directory the resource file is placed in:

Resource Directory Embedded Resource Prefix Property Type Property Prefix Description
Binary RBIN - - Not exposed as properties. Only accessible as embedded resources.
Cursors RCUR NCursor Cursor Exposed as NCursor instances.
Fonts RFONT NFont Font Exposed as NOTResourceInstalledFont instances. Prior to using such font in your application, you should install it in your application's font service:
Images RIMG NImage Image Exposed as NImage instances.
Text RSTR string String Exposed as strings.


The following example shows how to place an image embedded in resource in an image box:

Using an image embedded as resource
Copy Code
NImageBox imageBox = new NImageBox(NResources.Image_MyImage_png);


In many cases, especially when dealing with binary resources, you may need to get the data stream of a resource. In this case you should use the GetResourceStream method of the resources singleton class instance:

Getting a resource stream
Copy Code
using (Stream stream = NResources.Instance.GetResourceStream("RBIN_MyResource_zip"))
    // Process the resource stream here


If all you need is the resource byte data, then you can use the Data property of the embedded resource of interest or call the GetResourceBytes method of the resource container:

Getting resource byte data
Copy Code
// Method 1 - the Data property of the embedded resource
byte[] resourceData1 = NResources.RBIN_MyResource_zip.Data;

// Method 2 - the GetResourceStream method of the resource container
byte[] resourceData2 = NResource.Instance.GetResourceData("RBIN_MyResource_zip");
See Also
Send Feedback