Jump to content



Photo

Single transparent color with GUICtrlCreatePic?


  • Please log in to reply
No replies to this topic

#1 magician13134

magician13134

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 394 posts

Posted 23 May 2008 - 08:30 PM

I would like to use a GIF image that has transparent parts without converting the white to transparent... I made it in Photoshop, so there's defined transparent parts, and also white parts, but when I display it, both white and transparent show up as transparent

Actually, is it possible to use a transparent PNG as a control? I know you can set it to be the background of a layered GUI, but can I just make one a picture control? Thanks

Nevermind, a little digging got me the answer

------------------
I'm using this example, but it's stretching my images and there's no option to set size, GUICtrlSetPos doesn't work either...
AutoIt         
#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ; =============================================================================================================================== ; Description ...: Shows how to display a PNG image ; Author ........: Paul Campbell (PaulIA) ; Notes .........: ; =============================================================================================================================== ; =============================================================================================================================== ; Global variables ; =============================================================================================================================== Global $hGUI, $hImage, $hGraphic ; Create GUI $hGUI = GUICreate("Show PNG", 69, 59, -1, -1, $WS_POPUP) GUISetState() ; Load PNG image _GDIPlus_StartUp() $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\nav.png") ; Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)  _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) ; Loop until user exits do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown()


The image is 69x59px at 72dpi resolution, and it's getting cut off on both the left and the bottom... Does anyone know why that is?

Edited by magician13134, 24 May 2008 - 02:06 PM.









0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users