AddShapeByCode

<< Click to Display Table of Contents >>

Navigation:  MyCAD > Methods >

AddShapeByCode

public Int64 AddShapeByCode(MyCAD owner,String shapeName,MyDrawType drawType,PointF[] thePoints,Single angle,String text)

 

Description:

  Add shape by code, it is useful for automatic drawing. if you want add a image, please use AddImageShapeByCode.

 

Parameter:

 owner: instance of MyCAD

 shapeName: Shape's name

 drawType: The draw style of a shape

 thePoints: Points array

 angle: The  shape's angle

 text: It is of MyText only,set the text

 

Return value:

 Return value =-1,add shape unsuccessfully.

 Return value >=0,add shape successfully,the value is the ShapeId of the new shape

 

Example:

 private void menuItem14_Click(object sender, System.EventArgs e)

 {

         PointF[] thePoints = new PointF[2];

         thePoints[0] = new PointF(100,100);

         thePoints[1] = new PointF(200,200);

         myCAD1.AddShapeByCode(myCAD1,"lineShape",MyDrawType.Line,thePoints,0,"");

 }