Jump to content
Sign in to follow this  
Luigi

_GUICtrlToolbar_LoadBitmap load irregular image

Recommended Posts

Luigi

Hi, I try the example in _GUICtrlToolbar_LoadBitmap to load a build image, it is load, but when show, the image is strange, have irregular pixels... out of focus...

The original image file is BMP, with 72dpi, 32x32pixels...
I try recreate the same characteristcs, does not is fine.

Have any tip?
BMP 72 or 96 or other resolution? I try with many sizes (22x22, 24x24, 26x26) but it always cut the image...
Someone have success to create and load a new image in this function?

obs: I use PhotoFiltreStudio X, save image as BMP...

Maybe I missing something?

Best regards,

Detefon

 


Visit my repository

Share this post


Link to post
Share on other sites
UEZ

Can you upload the image please?

Br,

UEZ


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

Try this:

 

#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <GDIPlus.au3>

Example()

Func Example()
    _GDIPlus_Startup()
    Local $hGUI, $hToolbar, $hBmp1, $hBmp2, $hHBitmap
    Local Enum $e_idRed = 1000, $e_idGreen, $e_idBlue
    Local $sWow64 = ""
    If @AutoItX64 Then $sWow64 = "\Wow6432Node"
    Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images"

    ; Create GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    $hToolbar = _GUICtrlToolbar_Create($hGUI)
    _GUICtrlToolbar_SetBitmapSize($hToolbar, 16, 16)
    GUISetState(@SW_SHOW)

    ; Add bitmaps
    $hBmp1 = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\try.bmp")
    $hBmp2 = _GDIPlus_ImageResize($hBmp1, 16, 16)
    $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp2)
    _GDIPlus_BitmapDispose($hBmp1)
    _GDIPlus_BitmapDispose($hBmp2)
    _GUICtrlToolbar_AddBitmap($hToolbar, 1, 0, $hHBitmap)
    _GUICtrlToolbar_LoadBitmap($hToolbar, $sPath & "\green.bmp")
    _GUICtrlToolbar_LoadBitmap($hToolbar, $sPath & "\blue.bmp")

    ; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar, $e_idRed, 0)
    _GUICtrlToolbar_AddButton($hToolbar, $e_idGreen, 1)
    _GUICtrlToolbar_AddButton($hToolbar, $e_idBlue, 2)

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

Br,

UEZ


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
Luigi

UEZ, I try you version, unfortunately not work with me...

post-53968-0-40252600-1409338447.png

$hBmp1......[ 0x03592CB0 ] @error[ 0 ]
$hBmp2......[ 0x03593A18 ] @error[ 0 ]
$hHBitmap...[ 0x45050FC4 ] @error[ 0 ]
_GUICtrlToolbar_AddBitmap..@error[ 0 ]
 
Do not have error in functions... Perhaps something in bmp file?
Edited by Detefon

Visit my repository

Share this post


Link to post
Share on other sites
UEZ

You are using still WinXP?

Just tested in my WinXP VM and it works, too!

This is how it looks on my Win8.1:

2zfiumv.png

The bitmap file is in your script dir?

Br,

UEZ

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
Luigi

Greate tip! VM!

No, I am use W7.

One moment, starting VM...

You are write! Maybe the problem is my Windows 7...
Now the image is showed.

Thanks UEZ.  :thumbsup:  :thumbsup:  :thumbsup:

Edited by Detefon

Visit my repository

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  

×