TImageList

TImageList

Postby Paco Garcia » Tue Jan 31, 2006 9:40 pm

Hola

He hecho un añadido a la clase TImageList, creo que es interesante. Se le puede pasar un bitmap para que tome los dibujos de él en lugar de ir añadiendo elementos de uno en uno. Si necesitas 20 imágenes se hace un bitmap de (20*16) de ancho por 16 de alto y con el fondo del color que indiques en el cuarto parámetro.

Code: Select all  Expand view
METHOD New( nWidth, nHeight, cFileName, nColor ) CLASS TImageList

   DEFAULT nWidth := 16, nHeight := 16
   DEFAULT nColor := RGB(255,0,255)

   ::nWidth := nWidth
   ::nHeight := nHeight

   if file( cFileName )
      ::hImageList := ReadImageList( cFileName, nWidth, 10, nColor )
   else
      ::hImageList = ILCreate( nWidth, nHeight )
   endif
   ::aBitmaps   = {}

return Self


Code: Select all  Expand view
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
#include <commctrl.h>


HB_FUNC( READIMAGELIST )
{

   hb_retnl( (long) ImageList_LoadImage(  NULL,
                                    hb_parc(1),
                                    hb_parni(2),
                                    hb_parni(3),
                          (COLORREF)hb_parnl(4),
                      IMAGE_BITMAP, LR_LOADFROMFILE | LR_CREATEDIBSECTION ) );

}

#pragma ENDDUMP


Un saludo
User avatar
Paco Garcia
 
Posts: 172
Joined: Fri Oct 07, 2005 12:00 pm

Postby Antonio Linares » Wed Feb 01, 2006 2:12 pm

Paco,

gracias!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 142 guests