Jump to content
Sign in to follow this  
rootx

[SOLVED] _GUIImageList_Create _GUIImageList_AddIcon resolution

Recommended Posts

rootx

I would like to know how to increase the resolution of the icons in the grid.

$iColor = 5 is 32 bit DIB section.. but if I try with

$Image = _GUIImageList_Create(48,48,5,1)

the upscaling is very bad and pixelate, I have 32bit icon resolution with hight detail, how can I control or force the resolution of the icons ?

Thanks

Edited by rootx

Share this post


Link to post
Share on other sites
UEZ

Can you please post a reproducer script?

 

Thx.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
rootx

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $idListview, $hImage
    Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

    GUICreate("ImageList Create", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Load images
    $hImage = _GUIImageList_Create(48, 48,5,1)
   _GUIImageList_Add($hImage, _GUIImageList_AddIcon($hImage,@ScriptDir&"\ico.ico"))
 _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1", 0)
   
    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites
UEZ

What about ico.ico? What is the dimension?


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
UEZ

You have to upscale the icon manually and add it afterwards to the _GUIImageList_Create.

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Example()

Func Example()
    _GDIPlus_Startup()
    Local $idListview, $hImage
    Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

    GUICreate("ImageList Create", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Load images
    $hImage = _GUIImageList_Create(48, 48, 5, 1)

    ;load icon and upscale the icon to 48x48 pixels
    Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\empty.ico")
    Local $hBitmap_scaled = _GDIPlus_ImageResize($hBitmap, 48,  48)
    Local $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_scaled)
    _GDIPlus_BitmapDispose($hBitmap_scaled)
    _GDIPlus_BitmapDispose($hBitmap)

    _GUIImageList_Add($hImage, $hBitmap_GDI)
    _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1", 0)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
    _WinAPI_DeleteObject($hBitmap_GDI)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

 

Edited by UEZ
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
rootx

Perfect example

Thanks, I was really confused

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • rootx
      By rootx
       
      Local $hGui, $listview, $hImage Local $aArray = _FileListToArrayRec(IniRead($ini, "Name", "path", ""), "*file.exe", $FLTAR_FILES, 1, $FLTAR_SORT,$FLTAR_FULLPATH) $hGui = GUICreate("ImageList", 400, 300) $listview = _GUICtrlListView_Create($hGui, "", 2, 2, 394, 268) _GUICtrlListView_InsertColumn($listview, 0, "Programs", 300) $hImage = _GUIImageList_Create(32, 32) GUISetState() $fileArray = UBound($aArray) -1 For $y = 1 To $fileArray _GUIImageList_AddIcon($hImage, $IniRead($ini,$aArray[$y], "icon", "")) _GUICtrlListView_SetImageList($listview, $hImage, 1) _GUICtrlListView_AddItem($listview, $aArray[$y]) Next  
        I would like to place an icon dynamically from an .ini file. From the .ini file the name of the program is loaded properly , but the icon remains the same, It loads only the icon of the first program. could Someone help me?
      Thanks
      Mea culpa,
      $ico =_GUIImageList_AddIcon($hImage, $IniRead($ini,$aArray[$y], "icon", ""))
      _GUICtrlListView_SetImageList($listview, $hImage, 1)
      _GUICtrlListView_AddItem($listview, $aArray[$y],$ico)
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.