LAnnotation::SetNameOptions

#include "ltwrappr.h"

virtual L_INT LAnnotation::SetNameOptions(pNameOptions, uFlags)

pANNNAMEOPTIONS pNameOptions;

/* pointer to a structure that specifies name options */

L_UINT uFlags;

/* flags that determine which objects to process */

Sets the options for the annotation object.

Parameter

Description

pNameOptions

Pointer to an ANNNAMEOPTIONS structure that specifies the name options to set.

uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

 

Value

Meaning

 

0

Process only the specified object.

 

ANNFLAG_SELECTED

[0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the LAnnotation::IsSelected and LAnnotation::SetSelected functions.

 

ANNFLAG_NOTTHIS

[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

 

ANNFLAG_RECURSE

[0x0008] Process objects within a container, and within any subcontainers, down to any level.

 

ANNFLAG_NOTCONTAINER

[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.

 

ANNFLAG_NOINVALIDATE

[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to set the name options of any annotation object. To use this function, declare a variable of type ANNNAMEOPTIONS, and pass the address of this variable for pNameOptions. For more information, refer to the documentation for the structure ANNNAMEOPTIONS.

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnnotation::GetNameOptions

Topics:

Annotation Functions: Object Properties

 

Annotation Objects - Default Values

 

Annotation Objects - Automated Features

 

Using Color Values in LEADTOOLS

Example

//This example creates a sticky note annotation and sets properties
//using LAnnotation member functions. 
L_INT LAnnotation_SetNameOptionsExample(HWND hWnd)
{
   LBitmap MyBitmap; 
   RECT rect; 
   ANNRECT annRect; 
   ANNNAMEOPTIONS NameOptions; 
   L_UINT uFillMode;
   L_INT  nRet = 0;
   LSettings::UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT); 
   memset(&NameOptions, 0, sizeof(ANNNAMEOPTIONS)); 
   NameOptions.uStructSize = sizeof(ANNNAMEOPTIONS); 
   NameOptions.uFlags = ANNNAME_NAME_LENGTH; 
   LAnnNote MyAnnNote; 
   MyAnnNote.SetText( TEXT("Terry"));
   annRect.left = 50; 
   annRect.top = 50; 
   annRect.right = 150; 
   annRect.bottom = 150; 
   MyAnnNote.SetRect(&annRect); 
   //Set properties
   L_BOOL bRet; 
   L_TCHAR FontName[200];
   L_UINT uLen = 0;
   COLORREF rgb; 
   double dRet; 
   bRet = MyAnnNote.SetBackColor(RGB(0,100,0)); 
   bRet = MyAnnNote.SetForeColor (RGB(255,100,0)); 
   bRet = MyAnnNote.SetFontBold ();
   bRet = MyAnnNote. SetFontItalic ();
   bRet = MyAnnNote.SetFontName (TEXT("Courier"));
   bRet = MyAnnNote.SetFontSize (24); 
   bRet = MyAnnNote.SetFontStrikeThrough ();
   bRet = MyAnnNote.SetFontUnderline ();
   bRet = MyAnnNote.IsFontBold ();
   bRet = MyAnnNote.IsFontItalic ();
   bRet = MyAnnNote.GetFontName (FontName, &uLen);
   bRet = MyAnnNote.GetFontNameLen ();
   dRet = MyAnnNote.GetFontSize();
   bRet = MyAnnNote.IsFontStrikeThrough ();
   bRet = MyAnnNote.IsFontUnderline ();
   rgb = MyAnnNote.GetForeColor ();
   rgb = MyAnnNote.GetBackColor ();
   nRet = MyAnnNote.GetFillMode(&uFillMode, NULL);
   if (nRet != SUCCESS)
      return nRet;
   switch (uFillMode) 
   {
      case ANNMODE_TRANSPARENT: 
         AfxMessageBox(TEXT("FillMode: ANNMODE_TRANSPARENT"));
      break; 
      case ANNMODE_TRANSLUCENT: 
         AfxMessageBox(TEXT("FillMode: ANNMODE_TRANSLUCENT"));
      break; 
      case ANNMODE_OPAQUE: 
         AfxMessageBox(TEXT("FillMode: ANNMODE_OPAQUE"));
      break; 
   }
   //Set Fill mode to opaque
   MyAnnNote.SetFillMode (uFillMode, ANNMODE_OPAQUE, 0);
   MyAnnNote.SetVisible (TRUE); 
   MyAnnNote.GetNameOptions(&NameOptions, sizeof(NameOptions)); 
   NameOptions.pszName = (L_TCHAR *)malloc(lstrlen(TEXT("My Note Annotation")));
   lstrcpy(NameOptions.pszName, TEXT("My Note Annotation"));
   NameOptions.uNameLen = lstrlen(TEXT("My Note Annotation"));
   NameOptions.uFlags = ANNNAME_NAME; 
   MyAnnNote.SetNameOptions(&NameOptions, 0);
   MyAnnNote.GetBoundingRect(&rect);
   //Draw the annotation
   HDC hDC = ::GetDC(hWnd);
   MyAnnNote.Draw (hDC,&rect);
   ::ReleaseDC(hWnd, hDC);
   return SUCCESS;
}