Common Options of all controls in SOLIDWORKS property manager page

Edit ArticleEdit Article

All generated controls have common properties which can be customized

Control common properties
Control common properties

  1. Control icon selected from the standard library of icons
  2. Custom control icon loaded from the image
  3. 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(backgroundColor: KnownColor.Green, textColor: KnownColor.Yellow)]
public string TextField { get; set; } = "Sample Text";

Custom background and foreground colours applied to textbox
Custom background and foreground colours applied to textbox

Attribution

Tooltip

Tooltip for controls can be set by applying the DescriptionAttribute

Standard Icon

Standard icon added to text box control
Standard icon added to text box control

Standard icon defined in swControlBitmapLabelType_e enumeration can be set to control via ControlAttributionAttribute attribute.

[Description("Depth Value")]
[ControlAttribution(swControlBitmapLabelType_e.swBitmapLabel_Depth)]
public string Depth { get; set; }

Use the below map of all available standard icons:

Standard bitmap icons for Property Manager Page controls
Standard bitmap icons for Property Manager Page controls

  1. swBitmapLabel_LinearDistance
  2. swBitmapLabel_AngularDistance
  3. swBitmapLabel_SelectEdgeFaceVertex
  4. swBitmapLabel_SelectFaceSurface
  5. swBitmapLabel_SelectVertex
  6. swBitmapLabel_SelectFace
  7. swBitmapLabel_SelectEdge
  8. swBitmapLabel_SelectFaceEdge
  9. swBitmapLabel_SelectComponent
  10. swBitmapLabel_Diameter
  11. swBitmapLabel_Radius
  12. swBitmapLabel_LinearDistance1
  13. swBitmapLabel_LinearDistance2
  14. swBitmapLabel_Thickness1
  15. swBitmapLabel_Thickness2
  16. swBitmapLabel_LinearPattern
  17. swBitmapLabel_CircularPattern
  18. swBitmapLabel_Width
  19. swBitmapLabel_Depth
  20. swBitmapLabel_KFactor
  21. swBitmapLabel_BendAllowance
  22. swBitmapLabel_BendDeduction
  23. swBitmapLabel_RipGap
  24. swBitmapLabel_SelectProfile
  25. swBitmapLabel_SelectBoundary

Custom Icon

Custom icon can be set via overloaded constructor of ControlAttributionAttribute attribute

[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).


Product of Xarial Product of Xarial