tiger0101 发表于 2005-11-29 20:44:00

如何给一个实体赋任意颜色

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim pLine as AcadLine<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pLine.color=0~256(颜色值)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如果我要赋色如RGB(135,25,46),怎么实现

王咣生 发表于 2005-11-29 22:59:00

reply

<P>使用TrueColor属性:</P>
<P>Sub TrueColor_Test()<BR>&nbsp;&nbsp;&nbsp; ' This example draws a line and returns the RGB values<BR>&nbsp;&nbsp;&nbsp; Dim color As AcadAcCmColor<BR>&nbsp;&nbsp;&nbsp; Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")<BR>&nbsp;&nbsp;&nbsp; Call color.SetRGB(80, 100, 244)<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim line As AcadLine<BR>&nbsp;&nbsp;&nbsp; Dim startPoint(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim endPoint(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#<BR>&nbsp;&nbsp;&nbsp; endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)<BR>&nbsp;&nbsp;&nbsp; ZoomAll<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; line.TrueColor = color</P>
<P>End Sub</P>

tiger0101 发表于 2005-11-30 12:43:00

3ku
页: [1]
查看完整版本: 如何给一个实体赋任意颜色