Jump to content

Seeking reason why one transparent GIF works GuiCtrlCreatePic but another doesn't


Recommended Posts

I found the following code in a forum post by newbiescripter, which displays a transparent gif "crosshair".

#include <WindowsConstants.au3>

$x = @DesktopWidth/2 - 13/2
$y = @DesktopHeight/2 - 13/2

GUICreate("", 13, 13, $x, $y, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
GUICtrlCreatePic("target.gif",0,0,13,13)
GUISetState()

Sleep(3000)

It works great... with the gif file included in newbiescripter's post. I was able to modify the gif in CS6 for my needs but I'm really curious why another gif that I created from scratch in CS6 does not display with transparency in the same script. (I know how to create transparent gifs, and mine opens in CS6 with transparency intact.) I'm probably just knackered from long hours but I give up and submit my question here despite the probability of embarrassment. 

See attached. "Crosshair.gif" is the one that works. "Target.gif" is the one that doesn't. "Target.psd" is the original PSD file. (oops, not allowed)

post-76101-0-26652500-1370458123_thumb.g

post-76101-0-81242400-1370458141_thumb.g

Edited by timmy2
Link to comment
Share on other sites

Did you set correct height and weight for your picture?

 

Actually, I want the crosshairs to be smaller than the original so I changed my version of the code to 13 (see multiple occurrences) from the original value of 68. It shrinks the crosshair.gif file perfectly.  My target.gif is 8-bit just like crosshair.gif is.

Link to comment
Share on other sites

Use GDI+. Example here:

Br,

UEZ

 

Thank you for replying, UEZ, but what are the advantages of GDI+ over what newbiescripter used?

I'm trying to figure out why my gif's transparency won't play when the original gif's transparency will.

Link to comment
Share on other sites

Image handling via GDI+ is much better than using the built-in stuff. Why are built-in functions not working for some image formats properly? I don't know.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

×
×
  • Create New...