Fossil Rock Posted September 21, 2007 Share Posted September 21, 2007 (edited) I had to manipulate the png 'window' graphic to get the desired effect. I would like to get the grey.gif trick implemented to be able to use any png with transparency. This example demonstrates the ability to have changing backgrounds and labels behind a transparent png graphic. Feel free to improve it. expandcollapse popup;;; Original found @ 'http://www.autoitscript.com/forum/index.php?s=&showtopic=53726&view=findpost&p=406753' #include <A3LGDIPlus.au3> Global $hImage, $hGraphic _GDIP_StartUp() $hImage = _GDIP_ImageLoadFromFile(@ScriptDir & "\Window1.png") $iWidth = _GDIP_ImageGetWidth ($hImage) $iHeight = _GDIP_ImageGetHeight($hImage) $hGUI = GUICreate("Mod-It", $iWidth + 100, $iHeight + 100) GUISetBkColor(0xFFFFFF) $back = GUICtrlCreateGraphic(20,20,$iWidth + 8,$iHeight + 8) $hGraphic = _GDIP_GraphicsCreateFromHWND($hGUI) $label = GUICtrlCreateLabel("", 28, 40, 39, 17, $SS_CENTER) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 8, "", "", "Lucida Console") GUISetState() _GDIP_GraphicsDrawImage($hGraphic, $hImage, 20, 20) While 1 $nMsg = GUIGetMsg() $Pos1 = MouseGetPos() Select Case $nMsg = $GUI_EVENT_CLOSE Exit EndSelect Sleep(1) $Pos2 = MouseGetPos() Select Case $Pos1[0] <> $Pos2[0] Or $Pos1[1] <> $Pos2[1] move() EndSelect WEnd _GDIP_GraphicsDispose($hGraphic) _GDIP_ImageDispose($hImage) _GDIP_ShutDown() Func move() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) Sleep(30) GUICtrlSetBkColor($back, $color) GUICtrlSetData($label, StringRight((Hex(PixelGetColor($Pos[0], $Pos[1]))), 6)) _GDIP_GraphicsDrawImage($hGraphic, $hImage, 20, 20) Sleep(30) EndFunc Save this graphic as "Window1.png" in the script dir. Edited December 25, 2007 by Fossil Rock Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
gseller Posted September 21, 2007 Share Posted September 21, 2007 pretty cool, a bit jittery... Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 22, 2007 Author Share Posted September 22, 2007 Updated... check it out. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
gseller Posted September 22, 2007 Share Posted September 22, 2007 Cool, it pulls the color under the mouse and shows the color and the hex code for it. Nice... Link to comment Share on other sites More sharing options...
Zedna Posted September 22, 2007 Share Posted September 22, 2007 Nice example. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
TK_Incorperate Posted September 23, 2007 Share Posted September 23, 2007 C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(1,10) : ERROR: can't open include file <A3LGDIPlus.au3> #include <A3LGDIPlus.au3> ~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(6,15) : ERROR: _GDIP_StartUp(): undefined function. _GDIP_StartUp() ~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(7,63) : ERROR: _GDIP_ImageLoadFromFile(): undefined function. $hImage = _GDIP_ImageLoadFromFile(@ScriptDir & "\Window1.png") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(8,40) : ERROR: _GDIP_ImageGetWidth(): undefined function. $iWidth = _GDIP_ImageGetWidth ($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(9,40) : ERROR: _GDIP_ImageGetHeight(): undefined function. $iHeight = _GDIP_ImageGetHeight($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(14,47) : ERROR: _GDIP_GraphicsCreateFromHWND(): undefined function. $hGraphic = _GDIP_GraphicsCreateFromHWND($hGUI) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(20,51) : ERROR: _GDIP_GraphicsDrawImage(): undefined function. _GDIP_GraphicsDrawImage($hGraphic, $hImage, 20, 20) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(37,32) : ERROR: _GDIP_GraphicsDispose(): undefined function. _GDIP_GraphicsDispose($hGraphic) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(38,27) : ERROR: _GDIP_ImageDispose(): undefined function. _GDIP_ImageDispose($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(39,16) : ERROR: _GDIP_ShutDown(): undefined function. _GDIP_ShutDown() ~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3 - 10 error(s), 0 warning(s) Not everyone downloads UDF's or libraries, just a tip, add the UDF you use from the library in your script, or state that it needs that specific one downloaded. ~TK Link to comment Share on other sites More sharing options...
Achilles Posted September 23, 2007 Share Posted September 23, 2007 Nice work! I like how it works... It does flicker a bit though My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
BrettF Posted September 23, 2007 Share Posted September 23, 2007 C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(1,10) : ERROR: can't open include file <A3LGDIPlus.au3> #include <A3LGDIPlus.au3> ~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(6,15) : ERROR: _GDIP_StartUp(): undefined function. _GDIP_StartUp() ~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(7,63) : ERROR: _GDIP_ImageLoadFromFile(): undefined function. $hImage = _GDIP_ImageLoadFromFile(@ScriptDir & "\Window1.png") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(8,40) : ERROR: _GDIP_ImageGetWidth(): undefined function. $iWidth = _GDIP_ImageGetWidth ($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(9,40) : ERROR: _GDIP_ImageGetHeight(): undefined function. $iHeight = _GDIP_ImageGetHeight($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(14,47) : ERROR: _GDIP_GraphicsCreateFromHWND(): undefined function. $hGraphic = _GDIP_GraphicsCreateFromHWND($hGUI) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(20,51) : ERROR: _GDIP_GraphicsDrawImage(): undefined function. _GDIP_GraphicsDrawImage($hGraphic, $hImage, 20, 20) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(37,32) : ERROR: _GDIP_GraphicsDispose(): undefined function. _GDIP_GraphicsDispose($hGraphic) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(38,27) : ERROR: _GDIP_ImageDispose(): undefined function. _GDIP_ImageDispose($hImage) ~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3(39,16) : ERROR: _GDIP_ShutDown(): undefined function. _GDIP_ShutDown() ~~~~~~~~~~~~~~~^ C:\Users\Tyler\Desktop\New AutoIt v3 Script.au3 - 10 error(s), 0 warning(s) Not everyone downloads UDF's or libraries, just a tip, add the UDF you use from the library in your script, or state that it needs that specific one downloaded. ~TKIt was the wish of PaulIA to keep only the full library to be downloaded. That is so there isn't 100 different versions of 1 UDF. Just download the full one It's great! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted September 23, 2007 Share Posted September 23, 2007 (edited) Not everyone downloads UDF's or libraries, just a tip, add the UDF you use from the library in your script, or state that it needs that specific one downloaded.~TKYou must have Auto3Library installed. Search for it in examples forum.EDIT:everytime you will see #include <A3L....au3> it's part of Auto3Library Edited September 23, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BrettF Posted September 23, 2007 Share Posted September 23, 2007 You must have Auto3Library installed. Search for it in examples forum.EDIT:everytime you will see #include <A3L....au3> it's part of Auto3LibraryDon't you mean Auto3Lib Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 24, 2007 Author Share Posted September 24, 2007 Nice work! I like how it works... It does flicker a bit though Thanks... yeah, flicker is really hard to control in this example, but the example is to demonstrate layering controls under a transparent PNG. It should create a 3D effect. And if you don't update the data very often, the flicker will be minimal. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
lod3n Posted September 24, 2007 Share Posted September 24, 2007 Neat! It's nice to see unique PNG examples like this. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
TK_Incorperate Posted September 25, 2007 Share Posted September 25, 2007 You must have Auto3Library installed. Search for it in examples forum.EDIT:everytime you will see #include <A3L....au3> it's part of Auto3LibraryNawww.... I only test example scripts to see how peoples code work, give them feedback. I do not use other people's functions I try to always make my own, so it is more "original" you know? That's the only reason I haven't downloaded the functions library.~TK Link to comment Share on other sites More sharing options...
ashley Posted September 25, 2007 Share Posted September 25, 2007 quite nice Free icons for your programs Link to comment Share on other sites More sharing options...
lordofthestrings Posted September 26, 2007 Share Posted September 26, 2007 This serves as a good example! Thanks for the share. Link to comment Share on other sites More sharing options...
martin Posted September 26, 2007 Share Posted September 26, 2007 Nawww.... I only test example scripts to see how peoples code work, give them feedback. I do not use other people's functions I try to always make my own, so it is more "original" you know? That's the only reason I haven't downloaded the functions library.~TKOh, right. So you have deleted all the include files that came with AutoIt and replaced them with your own then. That's pretty cool. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
BrettF Posted September 26, 2007 Share Posted September 26, 2007 Big job too... are any of them better? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now