AddConstraint() public method

Add a constraint to RebarShapeDefinition.
public AddConstraint ( Type constraintType ) : ConstraintOnRebarShape
constraintType System.Type Type of constraint /// (the class must be subclass of ConstraintOnRebarShape).
return ConstraintOnRebarShape
コード例 #1
0
        /// <summary>
        /// Present a dialog to add a constraint to RebarShapeDef.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addConstraintButton_Click(object sender, EventArgs e)
        {
            using (AddConstraint addConstraint = new AddConstraint(m_rebarShapeDef.AllowedConstraintTypes()))
            {
                if (DialogResult.OK == addConstraint.ShowDialog())
                {
                    Type constraintType = addConstraint.ConstraintType;

                    // Add the constraint to RebarShapeDef.
                    ConstraintOnRebarShape constraint = m_rebarShapeDef.AddConstraint(constraintType);
                    propertyGrid.SelectedObject = constraint;
                    m_constraintsListBoxBinding.ResetBindings(false);
                    constraintListBox.SelectedItem = constraint;
                }
            }
        }