Gdi and Listview

Gdi and Listview

Postby Silvio.Falconi » Sat Dec 10, 2016 11:35 am

Today I saw this function of My friend Mastintin
here : http://forums.fivetechsupport.com/viewtopic.php?f=6&t=29805&hilit=gdibmp#p168761

the function create the iconl of a image

and I want ask to You if it is possible create or save into a listview control the thumbnail of a file

for a sample if the file is a image it could create a icon of preview of image

for a sample :

the first is a icon of excel
the second is the preview of second file (image)

Image


Now fopr save the image of the file into listview I made:

nImage := Icon_Read(cFile)
nImage := max(0,ILADDICON( oImageList:hImageList, nImage ) )
oItem = TListViewItem():New( oList )
oItem:cText = cFile
oItem:nImage = nImage
oItem:Create()

but I save only the icon of the file

I wish insert this possibilty to make the preview of the image file and the user can see the image immediately
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6771
Joined: Thu Oct 18, 2012 7:17 pm

Re: Gdi and Listview

Postby Antonio Linares » Thu Dec 15, 2016 8:32 am

Silvio,

Nice idea :-)

When you call ILADDICON() you are adding an icon and not a bitmap.

So first, you should convert the icon to a bitmap using FWH function BmpFromIcon()

then instead of calling ILADDICON() you should use

HB_FUNC( ILADD ) // ( HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask )

or

HB_FUNC( ILADDMASKED ) // ( HIMAGELIST himl, HBITMAP hbmImage, COLORREF nClrMask )


I just saw that we could also use this function:

HB_FUNC( ILLOADIMAGE ) // cFileName, nWidth, nImages, nClrTransparent

that seems to do all the work. You may also try it
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Silvio.Falconi and 80 guests