Imagelist : Icon and Bitmap from Resource

Imagelist : Icon and Bitmap from Resource

Postby Jimmy » Sat Feb 11, 2023 5:06 am

hi,

to load Resource into Imagelist i use
Code: Select all  Expand view
  iIcon := LoadIcon( GetResources(), "ICOUP" )
   iIcon := LoadIcon( GetResources(), "ICODOWN" )

   iImage := ILADDICON( ::oImageLHeader:hImageList, iIcon )

and
Code: Select all  Expand view
  iIcon := LoadBitmap( GetResources(), "GRID_ASC" )
   iIcon := LoadBitmap( GetResources(), "GRID_DSC" )

   iImage := ILADD( ::oImageLHeader:hImageList, iIcon )

it work with Icon but fail(?) on Bitmap that Way :(

---

when use "File"-Icon i use
Code: Select all  Expand view
  iTemp_0 := Icon_Read( ::cPath + cFile, 32 )
   ILADDICON( ::oImageListSmall:hImageList, iTemp_0 )

and
Code: Select all  Expand view
  aBitmaps := ::oWnd:ReadImage( ::cPath + cFile, { ::nIcoSmall + 8, ::nIcoSmall + 8 } )
   iTemp_0 := aBitmaps[ 1 ]
   ILADD( ::oImageListSmall:hImageList, iTemp_0 )
 

here both work

what can be the Problem that Bitmap from Resource seems not to work :?:
it there another Way to load Bitmap Resource into Imagelist :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Postby Natter » Sat Feb 11, 2023 10:14 am

There is such a file \source\function\Imgtxtio.prg
In it the function FW_ReadImage() - look at it
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Imagelist : Icon and Bitmap from Resource

Postby Jimmy » Sun Feb 12, 2023 5:31 am

hi,

do you mean that i can use FW_ReadImage() also for Resource :?:

if yes, how is the Syntax to get Bitmap from Resource :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Postby Natter » Sun Feb 12, 2023 8:07 am

FW_ReadImage(nil, "aaa")
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Imagelist : Icon and Bitmap from Resource

Postby Jimmy » Sun Feb 12, 2023 2:22 pm

hi,
Natter wrote:FW_ReadImage(nil, "aaa")

thx for Answer

i have try it and same Result :(
it must be something else in my CODE

CODE come from HMG where i have to change some HB_FUNC() for FiveWin
it have to do with Imagelist where Fivewin have a CLASS while HMG use it "in" HB_FUNC()

---

under HMG it work with Bitmap and i have spend a lot of Time under Fivewin before had Idea to use Icon :roll:
as i use Fivewin Imagelist also for File-Icon and Bitmap i know CLASS TImagelist() does work with Bitmap in Grid

but it fail in Grid-Header where i use up/down Arrow to show how it is "sort"

i need to look deeper why HB_FUNC for Fivewin does only work with Icon and not with Bitmap in Grid-Header
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Postby Jimmy » Tue Feb 14, 2023 4:20 am

hi,

found out what is going on with TImagelist()

Code: Select all  Expand view
Method AddIcon( oIcon )
   if ValType( oIcon ) == "C"
      ...
   else
      oIco = oIcon
   endif

so both Object or String can be used

Code: Select all  Expand view
METHOD Add( oBmpImage, oBmpMask )

want to have a Object so LoadBitmap() or ReadImage() fail as they return hBITMAP Handle

so i made this
Code: Select all  Expand view
  DEFINE BITMAP oBMP RESNAME "GRID_ASC"
   iImage := ::oImageLHeader:Add( oBMP )
   DeleteObject( oBMP )

now i got Bitmap in Grid-Header :D

... but Icon look better ... Transparency of Bitmap is not working ...
Image
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests