L_ILM_SETSELBITMAP

Send this message to set the item selection bitmap and transparent color for the ImageList Control.

Parameter

Description

wParam

COLORREF value to be used as the transparent color.

lParam

Pointer to the bitmap to use as the selection bitmap.

 

Returns

>=0

The number of the currently visible page

< 0

An error occurred. Refer to Return Codes.

Comments

Use this message to set a user-defined bitmap to be used to display selected items when the selection style is set to SELECTIONSTYLE_USERBITMAP. The bitmap that you specify will be drawn with the specified color as transparent, and will be centered around each selected item.

The associated macro is:

L_ImgListSetSelBitmap

For a complete list of available macros, refer to the Ltlst.h file.

See Also

Functions:

L_ILM_SETSELOPTIONS, L_ILM_GETSELOPTIONS, L_ILM_GETITEMOPTIONS, L_ILM_SETITEMOPTIONS

Topics:

Using the ImageList Control

 

Image List Control Messages

 

Using Color Values in LEADTOOLS

Example

this sample loads a bitmap from a resource as a DDB, converts it to a DDB, and then sets that as the selection bitmap

L_INT ILM_SETSELBITMAPExample(HWND hWnd, HWND hCtrl,HINSTANCE hInst)
{
   HBITMAP hBitmap=NULL;
   BITMAPHANDLE Bitmap;
   HDC hDC=NULL;
   LILSELOPTION Opt;
  
   if(IsWindow(hCtrl))
   {
      /* get current selection options */
      SendMessage(hCtrl, L_ILM_GETSELOPTIONS, 0, (LPARAM)&Opt); 

      hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FLAG));

      if(hBitmap)
      {
         hDC = GetDC(hWnd);
         if(L_ConvertFromDDB(hDC, &Bitmap, sizeof(BITMAPHANDLE), hBitmap, NULL)==SUCCESS)
         {
            SendMessage(hCtrl, L_ILM_SETSELBITMAP, (WPARAM)RGB(0,255,0), (LPARAM)&Bitmap); 
            L_FreeBitmap(&Bitmap); 
         }
         DeleteObject(hBitmap); 
         ReleaseDC(hWnd, hDC); 
      }
      Opt.uSelectionStyle = SELECTIONSTYLE_USERBITMAP;
      SendMessage(hCtrl, L_ILM_SETSELOPTIONS, 0, (LPARAM)&Opt); 
      RedrawWindow(hCtrl, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); 
   }
   return SUCCESS;
}