Dieuz Posted May 10, 2007 Share Posted May 10, 2007 (edited) Here's my problem: I edited a .gif picture to make a transparent background (with photoshop). When I try to add this picutre into my gui, it make the background of my picture White! I dont want any background on my picture. I just want the red circle alone with nothing around it. How can I set the background of my picture transparent (so the background will have the same color as the gui background)?SEE ATTACHED FILEAs you can see the picture have an transparent background but when I add it into my gui, it doesnt look transparent#include <GuiConstants.au3> GuiCreate("Picture", 200, 250,-1, -1 ) $picture = GuiCtrlCreatePic(@ScriptDir & "\Images\bille1.gif", 100,185,0,0) GUICtrlSetBkColor($picture, $GUI_BKCOLOR_TRANSPARENT) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd ExitTransparent_Background.rar Edited May 10, 2007 by Dieuz Link to comment Share on other sites More sharing options...
Zedna Posted May 10, 2007 Share Posted May 10, 2007 (edited) Look hereEDIT: it's also described in HelpFile at GuiCtrlCreatePic() Edited May 10, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dieuz Posted May 10, 2007 Author Share Posted May 10, 2007 (edited) That doesnt work If I use $WS_EX_LAYERED, it make the background of my picture invisible and I can see through the window and I dont want that. I just want to see the background of my gui window. Edited May 10, 2007 by Dieuz Link to comment Share on other sites More sharing options...
Zedna Posted May 10, 2007 Share Posted May 10, 2007 Helpfile - GUICtrlCreatePic()To have a transparent picture it is needed to use a .gif image with the transparency color set and to create the window with WS_EX_LAYERED extended style. See example 2. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dieuz Posted May 10, 2007 Author Share Posted May 10, 2007 Helpfile - GUICtrlCreatePic()I tried this EXACTLY and the background of my picture become invisible and I can see through the windows. I dont want to be able to see through the window I just want the white to disseapear. Try it by yourself with the code I have you. Link to comment Share on other sites More sharing options...
lod3n Posted May 10, 2007 Share Posted May 10, 2007 This works. Mostly copied from the help file. The help file example illustrates two GUIs. #include <GUIConstants.au3> $gui=GUICreate("test transparentpic", 200, 250) $pic=GUICreate("", 200, 250, 0, 0,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic(@ScriptDir & "\bille1.gif", 100,185,0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd ExitA tip about the help file: take the example and modify it bit by bit until it suits your needs. When your changes break it, undo and find out why. The opposite is copying and pasting the one line you think you need, and they copying and pasting more when it doesn't work - I think that's much harder. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Dieuz Posted May 11, 2007 Author Share Posted May 11, 2007 Yep that work fine If I have only 1 picture but in my Gui I have multiples picture and when I use $WS_EX_LAYERED, every white colors on my pictures become transparent but I just want this setting for 1 picture. The $WS_EX_LAYERED is applied to all the window but how can I set it for only one picture? Link to comment Share on other sites More sharing options...
Zedna Posted May 11, 2007 Share Posted May 11, 2007 Yep that work fine If I have only 1 picture but in my Gui I have multiples picture and when I use $WS_EX_LAYERED, every white colors on my pictures become transparent but I just want this setting for 1 picture. The $WS_EX_LAYERED is applied to all the window but how can I set it for only one picture?Make your LAYERED inner GUI window with size of your picture (instead of size main GUI window) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MasonMill Posted April 4, 2014 Share Posted April 4, 2014 (edited) I was wanting to do the same thing the OP wants but i want to also make it transparent. Why does it not work when I put in the $WS_EX_TRANSPARENT like below? #include <GUIConstants.au3> $gui=GUICreate("test transparentpic", 200, 250) $pic=GUICreate("", 200, 250, 0, 0,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD,$WS_EX_TRANSPARENT),$gui) GUICtrlCreatePic(@ScriptDir & "\bille1.gif",100,185,0,0) WinSetTrans ( $pic, "", 50 ) GUISetState(@SW_SHOW,$pic) Sleep(1e9) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Are you able to make it transparent and without the white background together? Thanks, Mason Edited April 4, 2014 by MasonMill Link to comment Share on other sites More sharing options...
UEZ Posted April 4, 2014 Share Posted April 4, 2014 Try this: #include <GUIConstants.au3> #include <GDIPlus.au3> Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() $himg=_GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif") $hbmp=_GDIPlus_BitmapCreateHBITMAPFromBitmap($himg) _GDIPlus_ImageDispose($himg) $gui=GUICreate("test transparentpic", 200, 250) $pic=GUICtrlCreatePic("",60,85,68,71) _WinAPI_DeleteObject(GUICtrlSendMsg($pic,$STM_SETIMAGE,$IMAGE_BITMAP,$hbmp)) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hbmp) _GDIPlus_Shutdown() ExitLoop EndSelect WEnd Exit 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 More sharing options...
Moderators Melba23 Posted April 5, 2014 Moderators Share Posted April 5, 2014 MasonMill,This thread is nearly 7 years old - please do not necro-post this far back again. We do not encourage it because AutoIt has changed enormously since then and it is very unlikely the problem and/or code are still relevant today. We much prefer that you start a new thread and link to the old one if necessary. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ihatejavascript97 Posted January 10, 2023 Share Posted January 10, 2023 On 5/10/2007 at 11:28 PM, Zedna said: Helpfile - GUICtrlCreatePic() read the questions before answering thanks. Link to comment Share on other sites More sharing options...
ihatejavascript97 Posted January 10, 2023 Share Posted January 10, 2023 On 4/5/2014 at 9:32 AM, Melba23 said: MasonMill, This thread is nearly 7 years old - please do not necro-post this far back again. We do not encourage it because AutoIt has changed enormously since then and it is very unlikely the problem and/or code are still relevant today. We much prefer that you start a new thread and link to the old one if necessary. M23 til today there is no solution to this problem! thats a basic function. autoit su--s Link to comment Share on other sites More sharing options...
Developers Jos Posted January 10, 2023 Developers Share Posted January 10, 2023 (edited) 1 hour ago, ihatejavascript97 said: til today there is no solution to this problem! thats a basic function. autoit su--s Sure... Please go somewhere else moaning instead of necro posting in old threads. .. and think before you reply or post again in our forums as the next post like this gets your ass banned. Edited January 10, 2023 by Jos Typo Skeletor 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts