AddUserDefineShapeFromLib

<< Click to Display Table of Contents >>

Navigation:  MyCAD > Methods >

AddUserDefineShapeFromLib

public Int32 AddUserDefineShapeFromLib(MyLibrary myLibrary,String udShapeName,Int32 centerX,Int32 centerY,MyCAD myCAD,String encoding)

 

Description:

  Get from library by user-defined shape's name. and add user-defined shape into MyCAD instance.

 

Parameter:

 myLibrary: Instance of MyLibrary

 udShapeName: User-defined shape's name

 centerX,centerY: The shape's center position that you want placed

 myCAD: Instance of MyCAD

 encoding: The coding of character

 

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 myCAD1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)

 {

         if (e.Data.GetDataPresent(typeof(string)))

         {

                 string strData = (string)e.Data.GetData(typeof(string));

                 myCAD1.AddUserDefineShapeFromLib(myLibrary,strData,clientPoint.X,clientPoint.Y,myCAD1,"gb2312");

         }

 }