Measurement Units in Windows Forms Diagram

27 Apr 20211 minute to read

The Diagram control provides a multiple logical unit of measurement option. The following are the measurement units that are supported by the Diagram control.

  • Pixel
  • Point
  • Document
  • Display
  • SixteenthInch
  • EighthInch
  • QuarterInch
  • HalfInch
  • Inch
  • Foot
  • Yard
  • Mile
  • Millimeter
  • Centimeter
  • Meter
  • Kilometer
  • Custom
Property Description
MeasurementUnits Specifies whether to get or set the Measurement unit for the Model. The default value is Pixel.
CustomUnitValue Specifies whether to set the Custom Measurement unit value for the model, if the MeasurementUnits is set to Custom. The default value is 0.5.

The following code example illustrates to set measurement unit for the diagram.

diagram1.Model.MeasurementUnits = MeasureUnits.Point;
diagram1.Model.MeasurementUnits = MeasureUnits.Pixel

Custom Measurement unit

The MeasureUnits contain constant values to apply in our Diagram. So, you can use MeasureUnits.Custom to set the customized unit and specify the Custom Measurement unit value by using the Syncfusion.Windows.Forms.Diagram.Model.CustomUnitValue property.
The following code example illustrates how to set custom measurement unit for the Diagram control.

this.diagram1.Model.MeasurementUnits = MeasureUnits.Custom;
this.diagram1.Model.CustomUnitValue = 0.25f;
Me.diagram1.Model.MeasurementUnits = MeasureUnits.Custom
Me.diagram1.Model.CustomUnitValue = 0.25f