美文网首页
solidworks 属性页

solidworks 属性页

作者: dududuwei | 来源:发表于2018-05-20 10:04 被阅读0次
    属性.png
    '定义过id,添加控件
    Sub AddControls()
            Dim options As Integer
            Dim leftAlign As Integer
            Dim controlType As Integer
    
            '新建三个组
            options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible
            group1 = ppage.AddGroupBox(group1ID, "长", options)
    
            options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible
            group2 = ppage.AddGroupBox(group2ID, "宽", options)
    
            options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible
            group3 = ppage.AddGroupBox(group1ID, "厚", options)
    
            '添加控件到组一
            '数字输入框Num1
            controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox
            leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
            options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
            num1 = group1.AddControl(num1ID, controlType, "Sample Numberbox", leftAlign, options, "Allows numerical input")
            If Not num1 Is Nothing Then
                num1.SetRange(swNumberboxUnitType_e.swNumberBox_Length, 100.0, 0.0, 0.01, True)
                num1.Value = 0.05
            End If
    
            '添加控件到组2
            '数字输入框Num2
            controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox
            leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
            options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
            num2 = group2.AddControl(num2ID, controlType, "Sample Numberbox", leftAlign, options, "Allows numerical input")
            If Not num2 Is Nothing Then
                num2.SetRange(swNumberboxUnitType_e.swNumberBox_Length, 100.0, 0.0, 0.01, True)
                num2.Value = 0.05
            End If
    
            '添加组件到组3
            'Num3
            controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox
            leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
            options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
            num3 = group3.AddControl(num3ID, controlType, "Sample Numberbox", leftAlign, options, "Allows numerical input")
            If Not num3 Is Nothing Then
                num3.SetRange(swNumberboxUnitType_e.swNumberBox_Length, 100.0, 0.0, 0.01, True)
                num3.Value = 0.01
            End If
        End Sub
    

    这是添加了三个数字输入框控件

    相关文章

      网友评论

          本文标题:solidworks 属性页

          本文链接:https://www.haomeiwen.com/subject/favzdftx.html