AnnNameOptions example for C++ Builder
//'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.
void TForm1::ExampleAnnNameOptions ( HANNOBJECT hObject )
{
LEADAnn1->AnnEnumerate
( hObject, ANNFLAG_RECURSE + ANNFLAG_NOTCONTAINER, "" );
}
void __fastcall TForm1::LEADAnn1AnnEnumerate(L_HANDLE hObject)
{
L_INT nObjectType;
LEADAnn1->AnnNameOptions->Flags = ANNNAME_ALL;
LEADAnn1->AnnGetNameOptions(hObject);
nObjectType = LEADAnn1->AnnGetType(hObject);
if (nObjectType == ANNOBJECT_BUTTON)
{
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;
}
else
{
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;
}
LEADAnn1->AnnNameOptions->NameOffsetX
= 10;
LEADAnn1->AnnNameOptions->NameOffsetY
= 10 ;
LEADAnn1->AnnNameOptions->FaceNameColor
= (TColor)RGB(0, 0, 0);
LEADAnn1->AnnNameOptions->BackNameColor
= (TColor)RGB(255, 255, 255);
LEADAnn1->AnnNameOptions->FontName
= "Arial";
LEADAnn1->AnnNameOptions->FontSize
= 12;
LEADAnn1->AnnNameOptions->Flags
= ANNNAME_ALL;
LEADAnn1->AnnSetNameOptions(hObject);
}