This is a sample test procedure that creates a region based on an annotation object.
You can use L_AnnGetRgnHandle and other API functions by adding leadunt
to the Uses section. You will also need leadtyp and leaddef for data
types and constant values.
procedure TForm1.TestAnnAPI();
var
hEllipseObject : L_HANDLE;
Rgn : L_HRGN;
Begin
// Create an ellipse object and define its location
hEllipseObject := LEADAnn1.AnnCreate(ANNOBJECT_ELLIPSE, True, True);
LEADAnn1.AnnDefine(hEllipseObject, 80, 60, ANNDEFINE_BEGINSET);
LEADAnn1.AnnDefine(hEllipseObject, 180, 260, ANNDEFINE_END);
// Get a region based on the object
L_AnnGetRgnHandle(hEllipseObject, nil, @Rgn);
// No longer need the Ann object
LEADAnn1.AnnDestroy(hEllipseObject, 0);
// Set the region into the control
LEADAnn1.SetRgnHandle(Rgn, 0, 0, L_RGN_SET);
// No longer need the handle. MUST free it
LEADAnn1.DeleteRgnHandle(Rgn);
// Test region is working
LEADAnn1.Emboss(EMBOSS_SE, 500);
End;
Amin Dodin
LEADTOOLS Technical Support
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)