Add a bit, GROBJ_REPLACE_EXISTING,for CreateGraphObject() to replace existing
void aa( double xx, int nColor, string strName = "line" )
{
GraphLayer gly = Project.ActiveLayer();
GraphObject goLine = gly.CreateGraphObject(GROT_LINE, strName, GROBJ_REPLACE_EXISTING);
goLine.SetProp( "attach" , 2 );
goLine.SetProp( "direction" , 2 );
goLine.SetProp( "x1" , xx);
goLine.SetProp( "y1" , 2 );
goLine.SetProp( "y2" , 8 );
goLine.SetProp( "color" , nColor);
goLine.SetProp( "arrowEndShape" , 1 );
}
|