#include "ltwrappr.h"

virtual L_INT LAnnotation::SetNameOptions(pNameOptions, uFlags)


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.



The function was successful.

< 1

An error occurred. Refer to Return Codes.


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


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


Win32, x64.

See Also




Annotation Functions: Object Properties


Annotation Objects - Default Values


Annotation Objects - Automated Features


Using Color Values in LEADTOOLS


//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; 
   L_UINT uFillMode; 
   L_INT  nRet = 0; 
   memset(&NameOptions, 0, sizeof(ANNNAMEOPTIONS)); 
   NameOptions.uStructSize = sizeof(ANNNAMEOPTIONS); 
   NameOptions.uFlags = ANNNAME_NAME_LENGTH; 
   LAnnNote MyAnnNote; 
   MyAnnNote.SetText( TEXT("Terry")); 
   annRect.left = 50; = 50; 
   annRect.right = 150; 
   annRect.bottom = 150; 
   //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) 
      AfxMessageBox(TEXT("FillMode: ANNMODE_TRANSPARENT")); 
      AfxMessageBox(TEXT("FillMode: ANNMODE_TRANSLUCENT")); 
      case ANNMODE_OPAQUE: 
      AfxMessageBox(TEXT("FillMode: ANNMODE_OPAQUE")); 
   //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); 
   //Draw the annotation 
   HDC hDC = ::GetDC(hWnd); 
   MyAnnNote.Draw (hDC,&rect); 
   ::ReleaseDC(hWnd, hDC); 
   return SUCCESS; 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help