请叫一个问题
为什么就第3个图形改不了轮廓粗细以及颜色呢?这是哪里出问题了这是代码:Private Sub CommandButton1_Click()ActiveDocument.Unit = cdrCentimeter
Dim a1, b1, c1 As String
a1 = TextBox1.Text
b1 = TextBox2.Text
c1 = TextBox3.Text
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
Dim s1, s2, s3, s4 As Shape
Set s1 = ActiveLayer.CreateRectangle(0, 0, a1, c1)
s1.Fill.ApplyNoFill
s1.Outline.SetProperties 0.1, OutlineStyles(0), CreateCMYKColor(100, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#
Set s2 = ActiveLayer.CreateRectangle(a1, 0, a1 * 1 + b1 * 1, c1)
s2.Fill.ApplyNoFill
s2.Outline.SetProperties 0.1, OutlineStyles(0), CreateCMYKColor(100, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#
Set s3 = ActiveLayer.CreateRectangle(a1 * 1 + b1 * 1, 0, a1 * 2 + b1 * 1, c1)
s3.Fill.ApplyNoFill
s2.Outline.SetProperties 0.1, OutlineStyles(0), CreateCMYKColor(100, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#
Set s4 = ActiveLayer.CreateRectangle(a1 * 2 + b1 * 1, 0, a1 * 2 + b1 * 2, c1)
s4.Fill.ApplyNoFill
s4.Outline.SetProperties 0.1, OutlineStyles(0), CreateCMYKColor(100, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#
End Sub
Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
End Sub
Private Sub CommandButton1_Enter()
End Sub
Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub TextBox3_Change()
End Sub
Dim a1, b1, c1 As String
a1 = TextBox1.Text
b1 = TextBox2.Text
c1 = TextBox3.Text
以上最好修改一下,
Dim a1, b1, c1 As Double
a1 = TextBox1.Value
b1 = TextBox2.Value
c1 = TextBox3.Value
String下数据计算容易出错,例如100+100貌似会等于100100而不是等于200
你的代码里面有一些乘1的,应该是这个问题。 Set s3 = ActiveLayer.CreateRectangle(a1 * 1 + b1 * 1, 0, a1 * 2 + b1 * 1, c1)
s3.Fill.ApplyNoFill
s3.Outline.SetProperties 0.1, OutlineStyles(0), CreateCMYKColor(100, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#
你写成S2.OUTLINEle ~~~~~~~~~~~~~~~:):):):):):):):):):):) zhangpingjun 发表于 2023-8-12 13:08
Set s3 = ActiveLayer.CreateRectangle(a1 * 1 + b1 * 1, 0, a1 * 2 + b1 * 1, c1)
s3.Fill.ApplyNoFil ...
我来试试,谢谢大佬 jiangyu 发表于 2023-8-12 14:41
Dim a1, b1, c1 As String
a1 = TextBox1.Text
b1 = TextBox2.Text
已经解决了!谢谢
页:
[1]