Skip to main content

Bitmap control in SOLIDWORKS property Manager Page

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

Imports CodeStack.SwEx.PMPage.Attributes
Imports System.Drawing
Imports CodeStack.SwEx.My.Resources

Public Class BitmapDataModel

Public Property Bitmap As Image = Resources.BitmapSample

End Class
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 Property BitmapLarge As Image = Resources.BitmapSample
[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.