Jump to content

Single transparent color with GUICtrlCreatePic?


Recommended Posts

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...

#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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...