AoRaToS Posted April 28, 2009 Share Posted April 28, 2009 (edited) I am working on a GUI, I found out that with $WS_EX_LAYERED it works very well and as I want it except for 1 thing, the letters become transparent, for that not to happen I have to put an image to show behind, is that right?Is it possible for me to just draw something behind instead of having to fileinstall a picture in my script?I've tried this:$hWnd = WinGetHandle("Options") _GDIPlus_Startup() $Graphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) _GDIPlus_GraphicsFillRect($Graphic, 0, 0, 190, 300)GUICtrlCreatePic($Graphic, 0, 0, 100, 200)with no luck, if I change the $Graphic in the createpic with a black picture I have it works...Do I have to create a jpg file with GDI and use it everytime? (Possible solution?)Any other way to do it, fast so that the GUI doesn't take long to appear..So acdtually what I need is a $WS_EX_LAYERED GUI but instead of transparent I want black or any other color I choose Edited April 28, 2009 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
AoRaToS Posted April 28, 2009 Author Share Posted April 28, 2009 Bump! Anyone able to help with this???? s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
GEOSoft Posted April 28, 2009 Share Posted April 28, 2009 GUISetBkColor()??? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 29, 2009 Share Posted April 29, 2009 and technically your supposed to wait 24 hours before you bump.... but yeah whats wrong with guisetbkcolor? [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] Link to comment Share on other sites More sharing options...
AoRaToS Posted April 29, 2009 Author Share Posted April 29, 2009 and technically your supposed to wait 24 hours before you bump.... but yeah whats wrong with guisetbkcolor?Sorry, I'll wait next time..I tried that, it doesn't seem to work, the text is still transparent and I can see what's behind the letters (the desktop, another window etc)And the Help file says:The background is always set to transparent. GUICtrlSetBkColor() has not effect on pic control.So I'm probably looking for some other way to do it.. s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 29, 2009 Moderators Share Posted April 29, 2009 Sorry, I'll wait next time..I tried that, it doesn't seem to work, the text is still transparent and I can see what's behind the letters (the desktop, another window etc)And the Help file says:The background is always set to transparent. GUICtrlSetBkColor() has not effect on pic control.So I'm probably looking for some other way to do it..Post a re-creation script (that people can actually run) that demonstrates the issue you are having. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AoRaToS Posted April 29, 2009 Author Share Posted April 29, 2009 (edited) Try this, it looks allot like my GUI so I have left a few controls so you can see what happens: What to do: Press More See how it looks Then drag the right window by pressing and holding on it's top It drags really well and the second window follows as wanted But the letters are transparent so you can see what's behind through them, I want them black Adding the GUICtrlSetBkColor() does nothing.. Then try removing the $WS_EX_LAYERED style from the Options GUI and see how it looks (as I want it to look) but try dragging the right one, the left doesn't follow and it get's painted over :/ So I want the black letters as they are without the $WS_EX_LAYERED style and the dragging I get with the style... expandcollapse popup#include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) $MainGUI = GUICreate("TEST", 205, 362, @DesktopWidth - 210, Default, BitOR($WS_POPUP, $WS_DLGFRAME), $WS_EX_TOOLWINDOW) GUICtrlCreatePic("", 1, 0, 205, 50, Default, $GUI_WS_EX_PARENTDRAG) $More = GUICtrlCreateButton("More", 82, 300, 40, 30) GUICtrlSetOnEvent($More, "Options") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Options() Local $Check[2] $OptionsGUI = GUICreate("Options", 190, 297, -195, +35, BitOR($WS_POPUP, $WS_OVERLAPPED), BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD, $WS_EX_CLIENTEDGE, $WS_EX_LAYERED), $MainGUI) $okbutton = GUICtrlCreateButton("OK", 30, 277, 60, 17, $BS_DEFPUSHBUTTON) $cancelbutton = GUICtrlCreateButton("Cancel", 100, 277, 60, 17) GUICtrlSetOnEvent($cancelbutton, "onExit") $Tab = GUICtrlCreateTab(2, 5, 187, 270) $Tab1 = GUICtrlCreateTabItem("TEST") $ChangeUserNameLabel = GUICtrlCreateLabel("TEST", 5, 33, 55, 20) $ChangeUserNameInput = GUICtrlCreateInput("", 70, 30, 115, 20) GUICtrlSetLimit(-1, 15) $ChangeRefreshLabel = GUICtrlCreateLabel("Auto-Refresh", 5, 58, 70, 20) $ChangeRefreshInput = GUICtrlCreateInput("", 70, 55, 30, 20) GUICtrlSetLimit(-1, 2) $Combo = GUICtrlCreateCombo("", 105, 55, 80, 20) GUICtrlSetData(-1, "seconds|minutes|hours") $Check[0] = GUICtrlCreateCheckbox("TEST1", 5, 80, 115, 20) $Check[1] = GUICtrlCreateCheckbox("TEST2", 5, 140, 115, 20) $Tab2 = GUICtrlCreateTabItem("TEST") GUICtrlCreateLabel("ZZZZZZZZZZZZZZ", 20, 33, 150, 20) $CheckUpdate = GUICtrlCreateButton("No limit", 45, 80, 100, 20) GUICtrlCreatePic("", 0, 0, 190, 300) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) EndFunc ;==>Options Func onExit() Exit EndFunc Edited April 29, 2009 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 29, 2009 Share Posted April 29, 2009 haven't looked into your code.. but i found setting the hex color to 0x020202 instead of 0x000000 works fine... (for black) you can just find a different shade of the color you want that is invisible... idk try it out if that works it works for me because in my scripts i always change the colors of controls except for buttons... [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] Link to comment Share on other sites More sharing options...
AoRaToS Posted April 30, 2009 Author Share Posted April 30, 2009 I tried it and it's not working :/ s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 30, 2009 Share Posted April 30, 2009 try putting the pic infront of everything else but after the GUIcreate [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] Link to comment Share on other sites More sharing options...
AoRaToS Posted April 30, 2009 Author Share Posted April 30, 2009 the letters still stay transparent and it's all black behind the tab, is there any other way I can make the drag work nice without the layered style? s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
reb Posted May 1, 2009 Share Posted May 1, 2009 I have added GUICtrlSetColor in 2 places. Run this code and see if it is what you want. REB MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
AoRaToS Posted May 1, 2009 Author Share Posted May 1, 2009 (edited) Thanks Reb, I think that's a good step forward, but still not all controls work with it, Instead of changind every controls color using the black shade 0x020202 that CodyBarrett gave me above, I used GUICtrlSetDefColor(0x020202, $OptionsGUI) and it works for most controls. the ones it doesn't work on I tried one their own but still stay the same, the resistant ones are the checkboxes and tabnames, their text color doesn't seem to change Edited May 1, 2009 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 (edited) well.. dont change button txt colors for some reason it makes the cpu load very high edit try using a label overtop of the txt of the radio Edited May 1, 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] Link to comment Share on other sites More sharing options...
AoRaToS Posted May 3, 2009 Author Share Posted May 3, 2009 Well what I want is the drag to work as intended, if it's in any way possible I would be glad...It's weird that it works with the layered style, and with the composited style (no controls though) and without them it doesn't s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
MrMitchell Posted May 3, 2009 Share Posted May 3, 2009 (edited) Thanks Reb, I think that's a good step forward, but still not all controls work with it, Instead of changind every controls color using the black shade 0x020202 that CodyBarrett gave me above, I used GUICtrlSetDefColor(0x020202, $OptionsGUI) and it works for most controls. the ones it doesn't work on I tried one their own but still stay the same, the resistant ones are the checkboxes and tabnames, their text color doesn't seem to change After you use GUICtrlSetDefColor, You might be having trouble with the checkboxes because of the default Windows Theme. Per the help file "Checkbox, Radio or Progress controls cannot be painted if the "Windows XP style" is used." So I changed to Classic Windows and the window looks pretty good except for the tabs still. Help file also says that tabs can't be colored so I don't know how you are going to get around that one!...yet I'm sure someone will find a way, though.Edit: Added screenshot, that's a shot of the GUI and child after displaying the child then dragging it around the screen. Edited May 3, 2009 by MrMitchell Link to comment Share on other sites More sharing options...
AoRaToS Posted May 3, 2009 Author Share Posted May 3, 2009 I've read that, most computers I run the program on have the old Windows theme so it would be mostly ok as you said, but I want a way that works well no matter what the theme is, If I could make a black picture behind the child it would be ok, if I could make the GUI drag WITH the child as expected without using the LAYERED style it would be even better cause the whole thing with the letters would be avoided...Any one else having ideas??I'm loosing my hope that it's possible... s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
AoRaToS Posted May 7, 2009 Author Share Posted May 7, 2009 So there is no way for this to happen I guess... s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
ResNullius Posted May 8, 2009 Share Posted May 8, 2009 I've read that, most computers I run the program on have the old Windows theme so it would be mostly ok as you said, but I want a way that works well no matter what the theme isDon't know if this will help, but you can set individual controls in your GUIs to use the classic Windows theme.See Siao's example here: http://www.autoitscript.com/forum/index.ph...st&p=402201 Link to comment Share on other sites More sharing options...
martin Posted May 8, 2009 Share Posted May 8, 2009 (edited) So there is no way for this to happen I guess... If you want a window to maintain it's position relative to another window then it's not particulary difficult no matter what type of window and what controls you have. Here is your code modified a bit. expandcollapse popup#include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) Global $OptionsGUI = -1 $MainGUI = GUICreate("TEST", 205, 362, @DesktopWidth - 210, Default, BitOR($WS_POPUP, $WS_DLGFRAME), $WS_EX_TOOLWINDOW) GUICtrlCreatePic("", 1, 0, 205, 50, Default, $GUI_WS_EX_PARENTDRAG) $More = GUICtrlCreateButton("More", 82, 300, 40, 30) GUICtrlSetOnEvent($More, "Options") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_MOVE,"Follow") While 1 Sleep(100) WEnd Func Options() if IsHWnd($OptionsGUI) then return Local $Check[2], $wp = wingetPos($MainGui) $OptionsGUI = GUICreate("Options", 190, 297, $wp[0] - 190,$wp[1], BitOR($WS_POPUP, $WS_OVERLAPPED), BitOR($WS_EX_TOOLWINDOW, $WS_EX_CLIENTEDGE));, BitOR($WS_POPUP, $WS_OVERLAPPED), BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD, $WS_EX_CLIENTEDGE, $WS_EX_LAYERED), $MainGUI) $okbutton = GUICtrlCreateButton("OK", 30, 277, 60, 17, $BS_DEFPUSHBUTTON) $cancelbutton = GUICtrlCreateButton("Cancel", 100, 277, 60, 17) GUICtrlSetOnEvent($cancelbutton, "onExit") $Tab = GUICtrlCreateTab(2, 5, 187, 270) $Tab1 = GUICtrlCreateTabItem("TEST") $ChangeUserNameLabel = GUICtrlCreateLabel("TEST", 5, 33, 55, 20) $ChangeUserNameInput = GUICtrlCreateInput("", 70, 30, 115, 20) GUICtrlSetLimit(-1, 15) $ChangeRefreshLabel = GUICtrlCreateLabel("Auto-Refresh", 5, 58, 70, 20) $ChangeRefreshInput = GUICtrlCreateInput("", 70, 55, 30, 20) GUICtrlSetLimit(-1, 2) $Combo = GUICtrlCreateCombo("", 105, 55, 80, 20) GUICtrlSetData(-1, "seconds|minutes|hours") $Check[0] = GUICtrlCreateCheckbox("TEST1", 5, 80, 115, 20) $Check[1] = GUICtrlCreateCheckbox("TEST2", 5, 140, 115, 20) $Tab2 = GUICtrlCreateTabItem("TEST") GUICtrlCreateLabel("ZZZZZZZZZZZZZZ", 20, 33, 150, 20) $CheckUpdate = GUICtrlCreateButton("No limit", 45, 80, 100, 20) GUICtrlCreatePic("", 0, 0, 190, 300) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) EndFunc;==>Options Func onExit() Exit EndFunc;==>onExit Func Follow($hWnd,$iMsg,$wParam,$lParam) Local $iX,$iY If $hWnd <> $MainGUI then return $iX = BitAnd($lParam,0xFFFF) $iY = BitAnd($lParam,0xffff0000)/0x10000 winmove($OptionsGUI,"",$iX - 190,$iY) EndFunc Edited May 8, 2009 by martin 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...
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