请高手指教!下面程序出来的公差上下是一致的,如果上公差是0会显示+0.0怎样才能显示成单个的0,并且+换成空一格?谁能指点下,谢谢! '点击确定按钮触发的事件 Private Sub cmdOk_Click() Dim tolPre As Integer Dim tolpre2 As Integer '设置主单位精度 dimObj.PrimaryUnitsPrecision = Me.cboPrecision.ListIndex '设置公差样式及公差值 If Me.OptionButton1 = True Then '不显示公差时 dimObj.ToleranceDisplay = acTolNone ElseIf Me.OptionButton3 = True Then '显示正负差时 dimObj.ToleranceDisplay = acTolSymmetrical '公差类型 dimObj.ToleranceHeightScale = 1 '高度比例 dimObj.ToleranceJustification = acTolBottom '对齐方式 dimObj.ToleranceUpperLimit = Me.TextBox2 '上限 dimObj.ToleranceLowerLimit = Me.TextBox2 '下限 tolPre = PreNum(Me.TextBox2) '获取小数点位数 dimObj.TolerancePrecision = tolPre '公差精度 dimObj.ToleranceSuppressTrailingZeros = False '指定是否输出标注值中的后续零 ElseIf Me.OptionButton2 = True Then '显示上下差时 dimObj.ToleranceDisplay = acTolDeviation dimObj.ToleranceJustification = acTolBottom dimObj.ToleranceUpperLimit = Me.TextBox1 dimObj.ToleranceLowerLimit = -(Me.TextBox3) If dimObj.ToleranceUpperLimit = dimObj.ToleranceLowerLimit Then dimObj.ToleranceHeightScale = 1 Else dimObj.ToleranceHeightScale = 0.71 End If tolPre = PreNum(Me.TextBox1) tolpre2 = PreNum(Me.TextBox3) If tolPre < tolpre2 Then tolPre = tolpre2 dimObj.TolerancePrecision = tolPre dimObj.ToleranceSuppressTrailingZeros = False ElseIf Me.OptionButton4 = True Then '显示上下限时 dimObj.ToleranceDisplay = acTolLimits dimObj.ToleranceHeightScale = 1 dimObj.ToleranceJustification = acTolBottom dimObj.ToleranceUpperLimit = Me.TextBox1 dimObj.ToleranceLowerLimit = -(Me.TextBox3) tolPre = PreNum(Me.TextBox1) tolpre2 = PreNum(Me.TextBox3) If tolPre < tolpre2 Then tolPre = tolpre2 dimObj.TolerancePrecision = tolPre dimObj.ToleranceSuppressTrailingZeros = False End If dimObj.Update Unload Me End Sub |