AnnNameOptions example for Delphi
//This sample enumerates all objects in a container,
//changing the object name and displaying it.
//If the object is a button, the name is restricted to appear within the bitmap bounds.
//If the object is not a button, the name is not restricted.
Procedure TForm1.ExampleAnnNameOptions ( hObject: HANNOBJECT );
begin
LEADAnn1.AnnEnumerate ( hObject, ANNFLAG_RECURSE + ANNFLAG_NOTCONTAINER, '' );
end;
procedure TForm1.LEADAnn1AnnEnumerate(hObject: L_HANDLE);
var
nObjectType: L_INT;
begin
LEADAnn1.AnnNameOptions.Flags:= ANNNAME_ALL;
LEADAnn1.AnnGetNameOptions(hObject);
nObjectType:= LEADAnn1.AnnGetType(hObject);
if (nObjectType = ANNOBJECT_BUTTON) Then
begin
LEADAnn1.AnnNameOptions.ShowName:= False;
LEADAnn1.AnnNameOptions.AnnotationName:= 'Name Restricted';
LEADAnn1.AnnNameOptions.NameRestrict:= False;
LEADAnn1.AnnNameOptions.FontBold:= False;
LEADAnn1.AnnNameOptions.FontItalic:= False;
LEADAnn1.AnnNameOptions.FontStrikeOut:= False;
LEADAnn1.AnnNameOptions.FontUnderline:= False;
LEADAnn1.AnnNameOptions.NameBackTransparent:= False;
end
else
begin
LEADAnn1.AnnNameOptions.ShowName:= True;
LEADAnn1.AnnNameOptions.AnnotationName:= 'Name UnRestricted';
LEADAnn1.AnnNameOptions.NameRestrict:= True;
LEADAnn1.AnnNameOptions.FontBold:= True;
LEADAnn1.AnnNameOptions.FontItalic:= True;
LEADAnn1.AnnNameOptions.FontStrikeOut:= True;
LEADAnn1.AnnNameOptions.FontUnderline:= True;
LEADAnn1.AnnNameOptions.NameBackTransparent:= True;
end;
LEADAnn1.AnnNameOptions.NameOffsetX:= 10;
LEADAnn1.AnnNameOptions.NameOffsetY:= 10 ;
LEADAnn1.AnnNameOptions.FaceNameColor:= RGB(0, 0, 0);
LEADAnn1.AnnNameOptions.BackNameColor:= RGB(255, 255, 255);
LEADAnn1.AnnNameOptions.FontName:= 'Arial';
LEADAnn1.AnnNameOptions.FontSize:= 12;
LEADAnn1.AnnNameOptions.Flags:= ANNNAME_ALL;
LEADAnn1.AnnSetNameOptions(hObject);
end;