Sign in to follow this  
Followers 0
eHrgo

Transparency problems.. GuiCtrlCreatePic Conflicts.

6 posts in this topic

#1 ·  Posted (edited)

Hi there,

There is not much code I can share you for this... thats quite usual situation:

At the begining I wouldn't create a post for that but I don't even suceed to recreate a background with transparency:

#include <GUIConstants.au3>

GUICreate("", 50, 50, -1, -1, $WS_POPUP,$WS_EX_LAYERED)
GUICtrlCreatePic(@ScriptDir&'/background.gif', 0,0,0,0)

While 1
    GUISetState(@SW_SHOW)
    Sleep(10)
Wend

Posted Image

Why isn't that working? I have a white background why this script!

I've heard about top left pixel on this forum, why? Transparency should be defined in software like photoshop, not by one pixel on top left corner?

I'm lost. Thanks for your time and your help.

Edited by eHrgo

Sorry for my Bad English.

Share this post


Link to post
Share on other sites



Up!

I've really tried anything, it worked with another script, with an other picture .. but now.. weird.


Sorry for my Bad English.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I've really tried anything, it worked with another script, with an other picture .. but now.. weird.

I don't see the issue. The transparency works fine for me. Might have helped if you had posted working code:

#include <GUIConstants.au3>

Opt("GuiOnEventMode", 1)
Global $avColors[3] = [0x0000FF, 0x00FF00, 0xFF0000]
$Time = @SEC

$hGUI = GUICreate("Transparency Test", 250, 100, -1, -1, -1,$WS_EX_LAYERED)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
GUICtrlCreatePic("C:\Temp\4kp3o7d.gif", 100, 25, 50, 50)
GUISetState()

While 1
    If @SEC <> $Time Then
        $Time = @SEC
        GUISetBkColor($avColors[Mod($Time, 3)])
    EndIf
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc

:lmao:

Edit: I was going to whine about the 0 width and 0 height, but I had missed this little gem in the help file for GuiCtrlCreatePic():

If you want to have a picture having the same size as the file content just use width=height=0.

Doh! :whistle: Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Works for me too!~

Just remember if you are going place controls on-top of a trans-pic, use the disable state

GUICtrlSetState( -1, $GUI_DISABLE)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Huuuuum, ok.

I found out something:

To be able to see through the Window (instead of juste seeing through the picture) you need the exact same code but you need to put a pixel of whatever color (different from white)... Every other pixel of the picture will be transparent!

Thats why this script:

#include <GUIConstants.au3>

GUICreate("", 50, 50, -1, -1, $WS_POPUP,$WS_EX_LAYERED)
GUICtrlCreatePic(@ScriptDir&'/background.gif', 0,0,0,0)

While 1
    GUISetState(@SW_SHOW)
    Sleep(10)
WendoÝ÷ Ø&§«ÞÙçßyËl!ûazÚ)çí¦,^+0+^b«¦'-º·°YezÖ©¥æ«¶iÉ ®§v)ð+^ÎÞ±ç­êkzø¨ºÃìj[r
+®*m!ûazÚ)çí¦,^+0«^½êÞÇ¢êéËn­ì"Y^µªiyªò¢êÝzÉ-¢§¶¬rh¯}âm¶ÿËb*bqÊ&ÿ¢_;?h+ayû+"¶Ê¢jeÆ­yÐnl¸­µéç£^­è§éißvîêíê梷¿»öÍ£ajÒ!j÷®×«²Ú(vØ^·
-­©ì¥ªÞÌjÇq©ð¢¹(¬(®H§ìZ^¶¬¼«y©i®åze¢¶ZrH+¢éÝ'âm¶ÿ]í|©Ç(þíÙ3¦:) :Ø^®:`h!¶Úþ-)ò¦'¢oùÛý³Héø¦    ݶ¬±Êâ¦Ö®¶­sb6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC° ¤uT7&VFRgV÷C²gV÷C²ÂSÂSÂÓÂÓÂb33cµu5õõUÂb33cµu5ôUôÄU$TB¤uT7G&Ä7&VFU267&DF"fײb33²ö&6¶w&÷VæBævbb33²ÂÃÃà ¤uT7G&Ä7&VFU267&DF"fײb33²ô÷FW"æ§rb33²ÂÃÃÃÂÓ ¥vÆR¢uT6WE7FFR5uõ4õr¢6ÆVW¥vVæ@

Posted Image

We can see the effect I described before is applied to the second GuiCtrlCreatePic ignoring the first one at all (no transparency)..

So we can't GuiCtrlCreate a Pic if we already use a Transparent background ... Another Bug?

Is there another way to create Square without pic? (modulable size?) thanks.


Sorry for my Bad English.

Share this post


Link to post
Share on other sites

Can't edit, but the color of "other.jpg" doesn't matter:

Posted Image


Sorry for my Bad English.

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  
Followers 0