IMetabaseCustomClass.Resource

Syntax

Resource: IResourceObject;

Description

The Resource property determines a repository resource, which will store custom class metadata.

Comments

The property is not determined by default, custom class metadata is stored in custom classes container. If a resource is determined for a class, it will store class name and description, a large icon and a small icon. To determine icons, use the LargeImage and SmallImage properties.

Example

Executing the example requires that the repository contains a resource with the CLS_RESOURCES identifier. The resource saves images with the LARGEICON and SMALLICON identifiers. A class with the 2889473 identifier is also created in repository custom metadata.

Add links to the Drawing, IO, and Metabase system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    CustomClassExtender: IMetabaseCustomExtender;
    CustomClass: IMetabaseCustomClass;
    Resource: IResourceObject;
Begin
    Mb := MetabaseClass.Active;
    // Get custom class container
    CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
    Resource := Mb.ItemById("CLS_RESOURCES").Bind As IResourceObject;
    // Change custom class
    CustomClass := CustomClassExtender.Classes.FindByClassId(2889473);
    CustomClass.Resource := Resource;
    CustomClass.LargeImage := New GxBitmap.CreateFromStream(Resource.Binaries.Value("LARGEICON"));
    CustomClass.SmallImage := New GxBitmap.CreateFromStream(Resource.Binaries.Value("SMALLICON"));
    // Save changes
    (CustomClassExtender As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, a resource to store metadata is determined for the specified custom class. Images from the resource are set as custom class icons.

See also:

IMetabaseCustomClass