Share

AdaptiveImage.Bitmap(ResourceManager, string) Method

Description

Creates a new System.Drawing.Bitmap from the provided System.Resources.ResourceManager and resource name.

Visual Basic

Public static Function Bitmap(
    resource As ResourceManager, 
    name As string
) As System.Drawing.Bitmap

C#

public static System.Drawing.Bitmap Bitmap(
    ResourceManager resource, 
    string name
);

Parameters

Parameters Description
ResourceManager resource The System.Resources.ResourceManager that contains the image data.
string name The name of the resource that contains the image data.

Returns

The created System.Drawing.Bitmap.

Remarks

This method retrieves image data from a System.Resources.ResourceManager.

The following types of objects are supported:

  • System.Drawing.Bitmap
  • System.Drawing.Icon
  • Array of System.Byte
An adaptive bitmap need to be stored as an array of System.Byte in resource. Other types lead to data loss.

The Managed Resource Editor automatically sets the type to System.Drawing.Bitmap when an adaptive bitmap is added. This could be avoided in one of the following ways:

  • Before adding, change the extension name of the adaptive bitmap file to an unknown one to the editor, for example ".bin".
  • After adding, edit the resx file in xml mode, and change the type to Byte[]. For example:
<data name="MyBitmap" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>MyBitmap.tif;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>

Links

AdaptiveImage Class, Autodesk.Windows.Forms Namespace

Was this information helpful?