Bitmap control in SOLIDWORKS property Manager Page

Edit ArticleEdit Article
Comments

Bitmap control
Bitmap control

Static bitmap will be created in the property manager page for the properties of Image type or other types assignable from this type, e.g. Bitmap

using CodeStack.SwEx.PMPage.Attributes;
using CodeStack.SwEx.Properties;
using System.Drawing;

public class BitmapDataModel
{
    public Image Bitmap { get; set; } = Resources.BitmapSample;

}

Bitmap size

Default size of the bitmap is 18x18 pixels, however this could be overridden using the BitmapOptionsAttribute by providing width and height values in the constructor parameters:

[BitmapOptions(48, 48)]
public Image BitmapLarge { get; set; } = Resources.BitmapSample;

Due to SOLIDWORKS API limitation bitmap cannot be changed as dynamic value after property manager page is displayed. Assign the image in the data model class constructor or as a default value of the property.

Notifications

All articles and code at CodeStack are now open-source and hosted on GitHub. If you want to contribute by modifying existing articles and code snippets, submitting new ones, reporting errors and bugs etc. please follow this blog post for more information. We appreciate any contribution.


Product of Xarial Product of Xarial