Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS Common Dialog C DLL Help

L_DlgSetFont

Show in webframe

#include "l_bitmap.h"

L_LTDLG_API L_HFONT L_DlgSetFont(hFont)

L_HFONT hFont;

/* handle to the selected font */

Sets the font for the LEADTOOLS Common Dialogs.

Parameter

Description

hFont

Handle to the selected font.

Returns

!NULL

The previous font.

NULL

An error occurred.

Comments

The default font is your systems default font.

Call this function with hFont set to NULL to use the default system font.

The hFont parameter will not be copied. You must insure that the hFont remains valid until it is no longer needed.

Required DLLs and Libraries

LTDLGKRN
LTKRN

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:

L_DlgGetString, L_DlgSetString, L_DlgSetFont

Topics:

Dialogs: Maintenance and General Use

 

Using Imaging Common Dialog

Example

#define LT_DLG_SOLARIZE_IDDLG             1001
#define LT_DLG_SOLARIZE_IDEDT_THRESHOLD   1002

L_VOID EXT_CALLBACK DlgHelpCB(L_UINT32 uFlag,
                              L_INT    nCtlID)
{
   switch ( uFlag )
   {
      case DLG_HELP_SOLARIZE:
      {
         switch (nCtlID )
         {
            case LT_DLG_SOLARIZE_IDDLG:
            case LT_DLG_SOLARIZE_IDEDT_THRESHOLD:
               MessageBox (NULL, TEXT("Help with Solarize!"), TEXT("Help"), MB_OK);
               break;

            default:
               break;
         }
         break ;
      }
   }
}

 L_INT DlgSetFontExample(HWND hWnd,pBITMAPHANDLE pBitmap)
{
   L_INT nRet;
   HDC      hDC;
   L_UINT   uLen;
   HFONT    hMyFont = NULL;
   L_TCHAR* pszString = NULL;
   L_TCHAR  szNewCaption [] = TEXT("My New Solarize Caption");

   hDC = GetDC (NULL);

   // set a custom font and string for the emboss dialog
   // NOTE, you should change the font name to a font on your system
   hMyFont = CreateFont ( - MulDiv (8, GetDeviceCaps(hDC, LOGPIXELSY), 72),
                          0,
                          0,
                          0,
                          FW_BOLD, 
                          FALSE, 
                          FALSE, 
                          FALSE,
                          DEFAULT_CHARSET, 
                          OUT_DEFAULT_PRECIS, 
                          CLIP_DEFAULT_PRECIS,
                          DEFAULT_QUALITY, 
                          DEFAULT_PITCH,
                          TEXT("Bones"));

   nRet = L_DlgInit ( DLG_INIT_COLOR );
   if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)
      return nRet;
   L_DlgSetFont (hMyFont);

   // Get the default caption string
   nRet = L_DlgGetStringLen ( DLG_SOLARIZE_IDSTR_CAPTION, &uLen ) ;
   if(nRet != SUCCESS)
      return nRet;

   // add 1, for the terminating NULL
   pszString = ( L_TCHAR* ) GlobalAlloc ( GMEM_FIXED, ( (uLen + 1) * sizeof ( L_TCHAR ) ) ) ; 

   nRet = L_DlgGetString ( DLG_SOLARIZE_IDSTR_CAPTION, pszString , uLen * sizeof ( L_TCHAR )) ;
   if(nRet != SUCCESS)
      return nRet;

   // display default caption string
   MessageBox ( hWnd, pszString, TEXT("Default"), MB_OK ) ;

   GlobalFree ( pszString ) ;

   // change caption string
   nRet = L_DlgSetString ( DLG_SOLARIZE_IDSTR_CAPTION, szNewCaption ) ;
   if(nRet != SUCCESS)
      return nRet;

   // now, display the dialog to see our changes
   {
      SOLARIZEDLGPARAMS DlgParams ; 

      memset ( &DlgParams, 0, sizeof ( SOLARIZEDLGPARAMS ) ) ;

      DlgParams.uStructSize     = sizeof ( SOLARIZEDLGPARAMS ) ;
      DlgParams.pBitmap         = pBitmap ;
      DlgParams.pfnHelpCallback = ( LTCOMMDLGHELPCB ) DlgHelpCB ;
      DlgParams.uDlgFlags       = DLG_SOLARIZE_AUTOPROCESS        |
                                  DLG_SOLARIZE_SHOW_CONTEXTHELP   |
                                  DLG_SOLARIZE_SHOW_PREVIEW       |
                                  DLG_SOLARIZE_SHOW_TOOL_ZOOMLEVEL;

      nRet = L_DlgSolarize ( hWnd, &DlgParams ) ;
      if(nRet < 1)
         return nRet;
   }

   L_DlgSetFont ( NULL ) ;
   L_DlgFree () ;
   DeleteObject ( hMyFont ) ;
   ReleaseDC ( NULL, hDC ) ;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.