| 
   Available in LEADTOOLS Vector Imaging toolkits.  | 
Start with the project you created in Working with Layers.
Take the following steps to start adding new layer and objects to the vector handle.
| 
 Note:  | 
 This tutorial will only use 3 types of objects (Line, Ellipse and Polygon) to keep things simple. You can refer to Vector object types all object types supported by the vector toolkit.  | 
| 
 1.  | 
 Click the "Class View" tab of the project workspace.  | 
| 
 2.  | 
 Click to open the MyVectorWindow branch.  | 
| 
 3.  | 
 Double-click the MsgProcCallBack () member function.  | 
| 
 4.  | 
 Add the following code immediately before case '1':  | 
case 'l':
case 'L':
   {
      // add a new vector line
      VECTORLINE     Line;
      L_INT          i;
      
      Line.Pen.nSize = sizeof( VECTORPEN );
      Line.Pen.bExtPen = FALSE;
      Line.Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
      Line.Pen.NewPen.LogPen.lopnWidth.x = 1;
      Line.Pen.NewPen.LogPen.lopnWidth.y = 1;
      Line.Pen.NewPen.LogPen.lopnColor = RGB( rand() % 246 + 10, rand() % 246 + 10, rand() % 246 + 10 );
      
      // set the line start and end points
      for( i = 0; i < 2; i++ )
      {
         Line.Point[ i ].x = rand() % 100;
         Line.Point[ i ].y = rand() % 100;
         Line.Point[ i ].z = rand() % 100;
      }
      
      LVectorLine VectorLine(&Line);
      
      // add to current active layer
      LVectorLayer VectorLayer;
      GetActiveLayer(&VectorLayer);
      VectorLayer.AddObject (&VectorLine );
      this->Reset ();
   }
   break;
   
case 'e':
case 'E':
   {
      VECTORELLIPSE     Ellipse;
      
      Ellipse.Point.x = rand() % 100;;
      Ellipse.Point.y = rand() % 100;;
      Ellipse.Point.z = rand() % 100;;
      
      Ellipse.Pen.nSize = sizeof( VECTORPEN );
      Ellipse.Pen.bExtPen = FALSE;
      Ellipse.Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
      Ellipse.Pen.NewPen.LogPen.lopnWidth.x = 2;
      Ellipse.Pen.NewPen.LogPen.lopnWidth.y = 2;
      Ellipse.Pen.NewPen.LogPen.lopnColor = RGB( rand() % 246 + 10, rand() % 246 + 10, rand() % 246 + 10 );
      
      Ellipse.Brush.nSize = sizeof(VECTORBRUSH);
      Ellipse.Brush.VectorBrushStyle = VECTORBRUSH_STANDARD;
      Ellipse.Brush.BrushType.StandardBrush.LogBrush.lbColor = RGB( rand() % 246 + 10, rand() % 246 + 10, rand() % 246 + 10 );
      Ellipse.Brush.BrushType.StandardBrush.LogBrush.lbStyle = BS_SOLID;
      
      Ellipse.xRadius = rand() % 10;;
      Ellipse.yRadius = rand() % 10;;
      
      LVectorEllipse VectorEllipse(&Ellipse);
      
      // add to current active layer
      LVectorLayer VectorLayer;
      
      GetActiveLayer(&VectorLayer);
      VectorLayer.AddObject (&VectorEllipse);
      Reset ();
   }
   break;
case 'g':
case 'G':
   {
      VECTORPOLYGON     Polygon;
      L_INT             i;
      
      //Create Polygon Object
      Polygon.Pen.nSize = sizeof( VECTORPEN );
      Polygon.Pen.bExtPen = FALSE;
      Polygon.Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
      Polygon.Pen.NewPen.LogPen.lopnWidth.x = 2;
      Polygon.Pen.NewPen.LogPen.lopnWidth.y = 2;
      Polygon.Pen.NewPen.LogPen.lopnColor = RGB( rand() % 246 + 10, rand() % 246 + 10, rand() % 246 + 10 );
      
      // set the polygon brush
      Polygon.Brush.nSize = sizeof( VECTORBRUSH );
      Polygon.Brush.VectorBrushStyle = VECTORBRUSH_STANDARD;
      Polygon.Brush.BrushType.StandardBrush.LogBrush.lbColor = RGB( rand() % 246 + 10, rand() % 246 + 10, rand() % 246 + 10 );
      Polygon.Brush.BrushType.StandardBrush.LogBrush.lbStyle = BS_SOLID;
      Polygon.Brush.BrushType.StandardBrush.LogBrush.lbHatch = 0;
      
      Polygon.nPointCount = rand() % 5 + 3;
      Polygon.Point = (pVECTORPOINT) malloc(Polygon.nPointCount * sizeof( VECTORPOINT ) );
      for( i = 0; i < Polygon.nPointCount; i++ )
      {
         Polygon.Point[ i ].x = rand() % 100;
         Polygon.Point[ i ].y = rand() % 100;
         Polygon.Point[ i ].z = rand() % 100;
      }
      
      // set polygon fill mode
      Polygon.nPolyFillMode = VECTOR_POLY_ALTERNATE;
      
      LVectorPolygon VectorPolygon(&Polygon);
      
      // add to current active layer
      LVectorLayer VectorLayer;
      GetActiveLayer(&VectorLayer);
      VectorLayer.AddObject (&VectorPolygon);
      
      free( Polygon.Point );
      Reset ();
   }
   break;
| 
 5.  | 
 Compile and run the demo.  | 
| 
 6.  | 
 Hit the 'L' key to create random lines. Hit the 'G' key to create random polygons. Hit the 'E' key to create random ellipses.  |