Jump to content

Recommended Posts

  • Developers
Posted

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)



 

#Region
#AutoIt3Wrapper_Res_File_Add=Resources-Slider\NotaryW2.png, RT_RCDATA, SSAA_PNG
#EndRegion

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <GDIPlus.au3>
#Include "Resource-LIB\resources.au3"

Example()

Func Example()

    Local $hGUI = GUICreate("ImageList Draw", 400, 300)
    Local $ctrl=GUICtrlCreateButton("Button1", 10, 10, 100, 100)
    GUISetState(@SW_SHOW)

         Local $hB=_ResourceGetAsBitmap("SSAA_PNG")

         _GDIPlus_Startup()
         $hB2 = _GDIPlus_BitmapCreateFromHBITMAP ($hB)
         $hB2 = _GDIPlus_ImageResize ( $hB2, 48, 48 )
         If @error Then MsgBox(64,"Error",@error)

         Local $hImageList = _GUIImageList_Create(64, 64, 5,1)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _WinAPI_DeleteObject( $hB2 )
        _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    _GDIPlus_Shutdown()
    GUIDelete()
EndFunc   ;==>Example


 

Edited by Parsix
Posted (edited)
13 minutes ago, Parsix said:



 

#Region
#AutoIt3Wrapper_Res_File_Add=Resources-Slider\NotaryW2.png, RT_RCDATA, SSAA_PNG
#EndRegion

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <GDIPlus.au3>
#Include "Resource-LIB\resources.au3"

Example()

Func Example()

    Local $hGUI = GUICreate("ImageList Draw", 400, 300)
    Local $ctrl=GUICtrlCreateButton("Button1", 10, 10, 100, 100)
    GUISetState(@SW_SHOW)

         Local $hB=_ResourceGetAsBitmap("SSAA_PNG")

         _GDIPlus_Startup()
         $hB2 = _GDIPlus_BitmapCreateFromHBITMAP ($hB)
         $hB2 = _GDIPlus_ImageResize ( $hB2, 48, 48 )
         If @error Then MsgBox(64,"Error",@error)

         Local $hImageList = _GUIImageList_Create(64, 64, 5,1)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _GUIImageList_Add($hImageList, $hB2)
        _WinAPI_DeleteObject( $hB2 )
        _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    _GDIPlus_Shutdown()
    GUIDelete()
EndFunc   ;==>Example


 

@error is set to 4

resources.au3

Edited by Parsix
Posted

You need to revert it back to an HBITMAP object after resizing, as _GUIImageList_Add does not accept GDI+ image.  Make sure you dispose HBITMAP object and GDI+ image correctly.  Your snippet is not doing it right.  Open help file and read about those functions and how to clean them up.

Posted
13 minutes ago, Nine said:

You need to revert it back to an HBITMAP object after resizing, as _GUIImageList_Add does not accept GDI+ image.  Make sure you dispose HBITMAP object and GDI+ image correctly.  Your snippet is not doing it right.  Open help file and read about those functions and how to clean them up.

i not found any thing

Posted
Local $img1=_ResourceGetAsBitmap($ResourceName)
Local $hImageList = _GUIImageList_Create(72, 72, 5)

;---Resize $img1 (hbitmap) for Imagelist
_GUIImageList_Add($hImageList, $img1)
;---or Resize $img1 in Imagelist
_GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)

 

Posted

have you solution for my problem?

Local $img1=_ResourceGetAsBitmap($ResourceName)
Local $hImageList = _GUIImageList_Create(72, 72, 5)

;---Resize $img1 (hbitmap) for Imagelist
_GUIImageList_Add($hImageList, $img1)
;---or Resize $img1 in Imagelist
_GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)

 

Posted (edited)
11 minutes ago, Jos said:

Which problem?  It helps when you try to put some effort in formulating a question when you want an answer. ;) 

How to

Resize $img1 (hbitmap) for Imagelist before add to imagelist

or

Resize $img1 in Imagelist

?

 

 

question 1: first list

how to convert gdi plus bitmap to image object or any for add to image list?

Edited by Parsix

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
×
×
  • Create New...