Common Options of all controls in SOLIDWORKS property manager page
All generated controls have common properties which can be customized
- Control icon selected from the standard library of icons
- Custom control icon loaded from the image
- Tooltip of the control displayed on mouse hovering
Style
Common styles can be customized via ControlOptionsAttribute by decorating the specific properties in data model.
This attribute allows to define the alignment, position, size as well as background and foreground colours:
<ControlOptions(,, KnownColor.Green, KnownColor.Yellow)>
Public Property TextField As String = "Sample Text"
[ControlOptions(backgroundColor: KnownColor.Green, textColor: KnownColor.Yellow)]
public string TextField { get; set; } = "Sample Text";
Attribution
Tooltip
Tooltip for controls can be set by applying the DescriptionAttribute
Standard Icon
Standard icon defined in swControlBitmapLabelType_e enumeration can be set to control via ControlAttributionAttribute attribute.
<Description("Depth Value")>
<ControlAttribution(swControlBitmapLabelType_e.swBitmapLabel_Depth)>
Public Property Depth As String
[Description("Depth Value")]
[ControlAttribution(swControlBitmapLabelType_e.swBitmapLabel_Depth)]
public string Depth { get; set; }
Use the below map of all available standard icons:
- swBitmapLabel_LinearDistance
- swBitmapLabel_AngularDistance
- swBitmapLabel_SelectEdgeFaceVertex
- swBitmapLabel_SelectFaceSurface
- swBitmapLabel_SelectVertex
- swBitmapLabel_SelectFace
- swBitmapLabel_SelectEdge
- swBitmapLabel_SelectFaceEdge
- swBitmapLabel_SelectComponent
- swBitmapLabel_Diameter
- swBitmapLabel_Radius
- swBitmapLabel_LinearDistance1
- swBitmapLabel_LinearDistance2
- swBitmapLabel_Thickness1
- swBitmapLabel_Thickness2
- swBitmapLabel_LinearPattern
- swBitmapLabel_CircularPattern
- swBitmapLabel_Width
- swBitmapLabel_Depth
- swBitmapLabel_KFactor
- swBitmapLabel_BendAllowance
- swBitmapLabel_BendDeduction
- swBitmapLabel_RipGap
- swBitmapLabel_SelectProfile
- swBitmapLabel_SelectBoundary
Custom Icon
Custom icon can be set via overloaded constructor of ControlAttributionAttribute attribute
<ControlAttribution(GetType(Resources), NameOf(Resources.OffsetImage))>
Public Property Offset As Double
[ControlAttribution(typeof(Resources), nameof(Resources.OffsetImage))]
public double Offset { get; set; }
Second version of the overloaded constructor allows to specify the transparency mask through shades of grey with boundaries of black pixels = 100% opaque and white pixels = 100% transparent. If first version of constructor is used mask will be generated automatically based on the transparency (Alpha channel of the image).