CodyBarrett Posted July 22, 2009 Posted July 22, 2009 well i have a grid of labels 64 infact XD and i would like PNG pictures to be set on them... when i try its not working... does $BS_BITMAP matter for .png? is there another fileformat that is supported with a transparent background? GUICtrlsetimage($Control, 'PNG.png') doesn't work at all... simply makes the square blank... my Labels are Transparent is thats what is making it blank? do i HAVE to use GDI+ (i would prefer it if i didn't have to even touch that area) to get the Width and Height? does any one know what i should do? XD [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 22, 2009 Posted July 22, 2009 You can use Yashied's Icons.au3 library to set the control's image/icon either by a handle to image or by a string representing the path to the file. Make sure that the label control doesn't contain $SS_CENTER style.
CodyBarrett Posted July 22, 2009 Author Posted July 22, 2009 :| $SS_CENTER is taht screwing it up? cause my labels style is this $LStyle = BitOR ($SS_CENTER, $SS_CENTERIMAGE,$BS_BITMAP ) [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 22, 2009 Posted July 22, 2009 ..and the fact that GUICtrlSetImage() is not for label controls and that png files are not supported.
CodyBarrett Posted July 23, 2009 Author Posted July 23, 2009 well... is it possible for a picture to be on a Label?.... or do i have to place a Pics on top of everything cause that would complicate things greatly [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 23, 2009 Posted July 23, 2009 Yes, perfectly valid and it's also very nice that you have the Icons.au3 UDF. #include <Icons.au3> Dim $hGUI = GUICreate('', 200, 200) Dim $Label = GUICtrlCreateLabel('', 0, 0, 200, 200) ; Try once when $SS_CENTER is specified and watch the difference. _SetImage($Label, @ScriptDir & '\image.png') GUISetState() Do Until GUIGetMsg() = -3 GUIDelete() Exit
CodyBarrett Posted July 23, 2009 Author Posted July 23, 2009 okay LOL thanks man also is there a way to remove the style before setting the image? Guictrlsetstyle ($Control, '') ? i dunno [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 23, 2009 Posted July 23, 2009 #include <Constants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> $hLabel = GUICtrlGetHandle($Label) _WinAPI_SetWindowLong($hLabel, $GWL_STYLE, BitAND(_WinAPI_GetWindowLong($hLabel, $GWL_STYLE), BitNOT($SS_CENTER))) You can wrap it in a function to make it a bit clearer.
CodyBarrett Posted July 23, 2009 Author Posted July 23, 2009 didn't know about Bitnot! can't i just go Guictrlsetstate ($Control, Bitor (Bitnot ($SS_CENTER), Bitnot ($SS_CENTERIMAGE))) ?? that would be simpler BTW i can't test any of this i'm at my cousins house [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 23, 2009 Posted July 23, 2009 (edited) The problem is because I'm lacking enough knowledge of how to get the control style without using the _WinAPI_GetWindowLong() method and it doesn't exposes functionality like:Func _WinAPI_GetWindowLong($hWnd, $iIndex) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) ; ...You have to get the handle of the control to use this function. Another thing is that I think that AutoIt does the same but ORing the value of the current control style and thus ORing NOT 1 which is 0xFFFFFFFE is useless (sort of controlled assignment..) still not what you need. You can do it using a predefined style variable or something that is ORed with $SS_CENTER where needed. Edited July 23, 2009 by Authenticity
CodyBarrett Posted July 25, 2009 Author Posted July 25, 2009 (edited) OMG!!! thank you this is perfect! i actually just had enough time to test it out and WOW thank you lol EDIT well it works... but also.. how do i remove the image so i can guictrlsetdata properly? cause when i remove the image the control won't accept text anymore Edited July 25, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
CodyBarrett Posted July 26, 2009 Author Posted July 26, 2009 anyone know how i can remove the image and set some text on it? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Authenticity Posted July 27, 2009 Posted July 27, 2009 #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Icons.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $hGUI = GUICreate('Title', 200, 200) Global $Label = GUICtrlCreateLabel('', 0, 0, 200, 150) Global $hLabel = GUICtrlGetHandle($Label) GUICtrlSetBkColor($Label, 0x602040) Global $Button = GUICtrlCreateButton('Test', 65, 160, 70, 23) _SetImage($Label, @ScriptDir & '\circle.png') AdlibEnable('_Test', 1500) GUISetState() While 1 Switch GUIGetMsg() Case $Button _WinAPI_SetWindowLong($hLabel, $GWL_STYLE, BitAND(_WinAPI_GetWindowLong($hLabel, $GWL_STYLE), BitNOT($SS_BITMAP))) GUICtrlSetState($Button, $GUI_DISABLE) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd AdlibDisable() GUIDelete() Exit Func _Test() GUICtrlSetBkColor($Label, Random(0x600000, 0x700000, 1)) EndFunc After you'll click the button, in the next invocation of the adlib function you won't see the image. Passing anything other that an image handle in the _SetHIMage() function or just sending $STM_SETIMAGE with a value which is not resolves to a bitmap handle will remove the control completely.
CodyBarrett Posted July 27, 2009 Author Posted July 27, 2009 well what i need is to get rid of the png... then be able to place Text into the now unused Label [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
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