Search the Community
Showing results for tags 'guictrlcreatepic'.
-
$img = GUICtrlCreatePic("", 500,0,1390,890) ... _GDIPlus_Startup() local $bitmap_1 = _GDIPlus_BitmapCreateFromMemory(InetRead($jpg_url)) local $bitmap_2 = _GDIPlus_ImageResize ($bitmap_1, 1390, 890) local $bitmap_3 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap_2) GUICtrlSendMsg($img, 0x0172, 0, $bitmap_3) _GDIPlus_BitmapDispose($bitmap_1) _GDIPlus_BitmapDispose($bitmap_2) _WinAPI_DeleteObject($bitmap_3) _GDIPlus_Shutdown() I think this is all the relevant code. I've never worked with any of these functions before (aside from GUICtrlCreatePic and setting it to a picture file, not setting it via memory via GUICtrlSendMsg) so I don't know how to clean up properly after loading/drawing an image to screen. I commented out everything and went line by line figuring out what stops the leak. BitmapDispose and DeleteObject work for the varables I created... $bitmap_1, 2, 3 are good. Now all that remains is the GUICtrlSendMsg line of code. When I comment just this line, the memory leak stops. Do I need to do something to clear the picture control? Or send a message to $img using GUICtrlSendMsg telling it to clear the previous image? The docs for the function don't show anything (https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSendMsg.htm) but I see it's being used to start/stop a marquee scrolling text for a progress bar control with the third parameter value 0/1... I tried this with Pic control thinking making 0 is for displaying the bitmap, and 1 is for clearing it, but it doesn't clear the memory. Help would be appreciated, thanks.
- 2 replies
-
- guictrlsendmsg
- memory leak
-
(and 3 more)
Tagged with:
-
FIrst of all, I apologize for the state of how it all looks as I had to remove thousands of lines to make a workable demo. It works, but it's not pretty. So if you see any inconsistencies just handwave it and they'll go away. 1. First issue is with Global $idPic = GUICtrlCreatePic('', 10, 45, 720, 405) on line 15. It works well however I want to center the image in the control by using $SS_CENTERIMAGE. The moment I add that style and click on a different image the new one simply repaints on top of the old one. Refer to function Func1 for repainting. I could always resize the picture control and place it in the middle based on the bitmap passed but seems like the $SS_CENTERIMAGE is (should be) the perfect solution. 2. Next is the fact that I couldn't find a way to make images scrollable with a horizontal bar only in the list view. Basically one row and infinite columns is what I'd like. I tried formatting the list with with just 1 item and all the rest are subitems however the images are not displayed. Seems like the isssue is with the _GUICtrlListView_SetView($idListview, 0). Specifically the fact that 0 value refers to large icons and the list is then treated differently. I'm wondering if there are any workarounds or similar solutions. 3. It seems there's a memory leak in function Func1. RAM increases each time a new thumbnail is loaded without releasing the old one when next one is drawn. Any help is much appreciated. Been stuck on couple of these for a few days now.
- 3 replies
-
- guictrlcreatepic
- guictrlcreatelistview
-
(and 1 more)
Tagged with:
-
Hi, I have a problem with GUICtrlCreatePic(). In topic WMPlayer.ocx how to change the shuttle picture? I wanted to replace the shuttle picture with a custom one (which I sent below the code) but got some weird results. #include <GuiConstants.au3> #include <Misc.au3> Global $Paused = False, $SliderButton = @ScriptDir & "\SliderButton.jpg" $hGui = GUICreate("Music Player", 400, 75, -1, -1) $Label1 = GUICtrlCreateButton("", 0, 0, 400, 20) ;music name GUICtrlSetState(-1, $GUI_DISABLE) $Shuttle = GUICtrlCreatePic($SliderButton, 0, 6, 30, 13) $PauseButton = GUICtrlCreateButton("Pause", 208, 40, 80, 20) GUISetOnEvent($PauseButton, "PauseButton") $PlayButton = GUICtrlCreateButton("Play", 112, 40, 80, 20) $Progress = GUICtrlCreateLabel("0:00", 4, 25, 45, 20, $SS_LEFT) ; current media position $Length = GUICtrlCreateLabel("0:00", 350, 25, 45, 20, $SS_RIGHT) ; media length GUISetState(@SW_SHOW) $FilePath = "" ;your music path & .mp3 $oPlayer = ObjCreate("WMPlayer.OCX") If Not IsObj($oPlayer) Then MsgBox(0, "WMPlayer.OCX", "Cannot create a WMP object.", 5) GUIDelete($hGui) Exit EndIf $iPos = 0 ; x coordinate of $Shuttle control in progress bar $hDLL = DllOpen("user32.dll") ; to dectect mouse down on the $Shuttle control $sliderLength = 380 ; in pixels $adlibInterval = 250 ; in milliseconds $oPlayer.Settings.Volume = 100 While 1 $oPlayer.URL = $FilePath $hTimer = TimerInit() While $oPlayer.playState <> 3 ; 1 - stopped, 2 - paused, 3 - playing If TimerDiff($hTimer) > 3000 Then MsgBox(0, "WMPlayer.OCX", $FilePath & @CRLF & @CRLF & "Cannot play this file.", 5) ExitLoop EndIf Sleep(5) WEnd If $oPlayer.playState <> 3 Then ContinueLoop EndIf $sFile = StringMid($FilePath, StringInStr($FilePath, "\", 0, -1) + 1) GUICtrlSetData($Label1, $sFile) $mediaLength = Int($oPlayer.currentMedia.Duration) ; in seconds GUICtrlSetData($Length, Int($mediaLength / 60) & ":" & StringFormat("%02i", Mod($mediaLength, 60))) AdlibRegister("Slider", $adlibInterval) $oPlayer.Controls.Pause While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $oPlayer.Close Exit Case $PlayButton If GUICtrlRead($PlayButton) = "Play" Then $oPlayer.Controls.Play AdlibRegister("Slider") GUICtrlSetData($PlayButton, "Stop") Else $oPlayer.Controls.currentPosition = 0 $oPlayer.Controls.Pause GUICtrlSetData($PlayButton, "Play") EndIf If $Paused Then While $Paused Sleep(100) WEnd EndIf Case $Shuttle AdlibUnRegister() $x = MouseGetPos(0) $xOffset = $x - $iPos While _IsPressed("01", $hDLL) = 1 $x = MouseGetPos(0) If $x > 380 + $xOffset Then $x = 380 + $xOffset ElseIf $x < $xOffset Then $x = $xOffset EndIf $iPos = $x - $xOffset GUICtrlSetPos($Shuttle, $iPos) Sleep(1) WEnd $mediaPos = $iPos / $sliderLength * $mediaLength $oPlayer.Controls.currentPosition = $mediaPos AdlibRegister("Slider", $adlibInterval) GUICtrlSetData($PauseButton, "Pause") EndSwitch If $oPlayer.playState = 1 Then ExitLoop EndIf WEnd WEnd Func PauseButton() If $Paused = False Then $oPlayer.Controls.Pause AdlibUnRegister() $Paused = True GUICtrlSetData($PauseButton, "Resume") Else $oPlayer.Controls.Play AdlibRegister("Slider") $Paused = False GUICtrlSetData($PauseButton, "Pause") EndIf EndFunc ;==>PauseButton Func Slider() $mediaPos = $oPlayer.Controls.currentPosition $iPos = $mediaPos * $sliderLength / $mediaLength GUICtrlSetPos($Shuttle, $iPos) GUICtrlSetData($Progress, Int($mediaPos / 60) & ":" & StringFormat("%02i", Mod($mediaPos, 60))) EndFunc ;==>Slider Also how can I set buttons to act like OnEvent button? I tried for $PauseButton but didn't make it. So I didn't do it for $PlayButton and $Shuttle. I want to add some lines from my main source to $PlayButton and since I used while loop in those lines (while the song is not over), I should control song (Pause/Resume, adjust position) anytime I want.
- 39 replies
-
- wmplayer.ocx
- guictrlcreatepic
-
(and 1 more)
Tagged with:
-
So normally you can use the arrow keys in a GUI to walk through all the controls, not unlike the tab key. But I recently realized that if you put a Pic control in the midst of your normal controls it interrupts the ability to move through the controls (the tab key still works). I really liked the arrow key functionality, and I'm wondering if there's a way to restore that capability without capturing and processing the arrow keys manually, or just moving the Pic creation to a different part of the code. I've whipped up a bit of code with some examples: #include <GUIConstants.au3> $sPic = StringLeft(@AutoItExe, StringInStr(@AutoItExe, '\', 0, -1)) & '\Examples\GUI\logo4.gif' ; This is the normal behaviour I'd like to keep. GUICreate('Good Example', 250, 150, @DesktopWidth/2 - 250) GUICtrlCreateButton('Button', 50, 0, 200, 30) GUICtrlCreateButton('Button', 50, 30, 200, 30) GUICtrlCreateButton('Button', 50, 60, 200, 30) GUICtrlCreateButton('Button', 50, 90, 200, 30) GUICtrlCreateButton('Button', 50, 120, 200, 30) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd GUIDelete() ; This is the bad behaviour I'd like to avoid. GUICreate('Example 2', 250, 150, @DesktopWidth/2 - 250) GUICtrlCreatePic($sPic, 0, 0, 50, 30) GUICtrlCreateButton('Button', 50, 0, 200, 30) GUICtrlCreatePic($sPic, 0, 30, 50, 30) GUICtrlCreateButton('Button', 50, 30, 200, 30) GUICtrlCreatePic($sPic, 0, 60, 50, 30) GUICtrlCreateButton('Button', 50, 60, 200, 30) GUICtrlCreatePic($sPic, 0, 90, 50, 30) GUICtrlCreateButton('Button', 50, 90, 200, 30) GUICtrlCreatePic($sPic, 0, 120, 50, 30) GUICtrlCreateButton('Button', 50, 120, 200, 30) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd GUIDelete() ; This is almost what I want, but notice it doesn't "loop" around like the first example. ; And also having to create the pictures out of sequence with the buttons is not ideal. GUICreate('Example 3', 250, 150, @DesktopWidth/2 - 250) GUICtrlCreateButton('Button', 50, 0, 200, 30) GUICtrlCreateButton('Button', 50, 30, 200, 30) GUICtrlCreateButton('Button', 50, 60, 200, 30) GUICtrlCreateButton('Button', 50, 90, 200, 30) GUICtrlCreateButton('Button', 50, 120, 200, 30) GUICtrlCreatePic($sPic, 0, 0, 50, 30) GUICtrlCreatePic($sPic, 0, 30, 50, 30) GUICtrlCreatePic($sPic, 0, 60, 50, 30) GUICtrlCreatePic($sPic, 0, 90, 50, 30) GUICtrlCreatePic($sPic, 0, 120, 50, 30) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd GUIDelete() The first GUI that opens demonstrates the behaviour I like. The second GUI demonstrates the problem. The third GUI is almost a solution, but the focus won't wrap around (eg: You can't just hold the down arrow and have the focus loop through the buttons, it sticks at the end). Also creating the pic controls out of sequence with the buttons makes my code harder to read.
-
Hello So I thought it would be cool to use my Gravatar account to display my gravatar in a local GUI. I use this code: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Example to download avatar from Gravatar and display locally #ce ---------------------------------------------------------------------------- ; Script Start ; includes #include <Crypt.au3> #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> ; declare Global vars Global $md5GraMail = '' ; will store email for Grvatar request request GravatarLogin() GetAvatar() Func GravatarLogin() ; get the email required for downloading the Gravatar Local $sGraMail = InputBox("Get Gravatar", "What is your email registered with Gravatar?", "someone@somewhere.com", "", -1, -1, 0, 0) ; from http://en.gravatar.com/site/implement/hash/ ; make the hash ; Local $dHash = _Crypt_HashData(GUICtrlRead($g_idInputEdit), $g_iAlgorithm) ; Create a hash of the text entered $md5GraMail = _Crypt_HashData(StringLower(StringStripWS($sGraMail, 8)), $CALG_MD5) ; lose the left two '0x' chars and convert to lower case $md5GraMail = StringLower(StringTrimLeft($md5GraMail, 2)) ; Display the result. MsgBox($MB_SYSTEMMODAL, "", $sGraMail & @CRLF & "md5 " & $md5GraMail, 15) EndFunc ;==>GravatarLogin ; example from Help file: /html/functions/InetGet.htm ; Download a file in the background. ; Wait for the download to complete. Func GetAvatar() ; Save the downloaded file to the temporary folder. Local $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; from http://en.gravatar.com/site/implement/images/ ; <img src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50" /> ; Download the file in the background with the selected option of 'force a reload from the remote site.' ; the next THREE options are alternatives ; Gravatar sample from here http://en.gravatar.com/site/implement/images/ ; 1 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; the normal code, should show user avatar ; 2 Local $hDownload = InetGet("https://www.gravatar.com/avatar/" & $md5GraMail & "?d=retro", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; my email hardcoded, downloads, but does not show avatar ; 3 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/cac637b47c9fecc8aa1dcdf71e7a4cc8", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize, 1) Local $MyGravatar = @ScriptDir & "\Gravatar.jpg" FileCopy($sFilePath, $MyGravatar) MsgBox(0, "Now showing!", $MyGravatar, 5) ; make gui and show file GUICreate("My Gravatar in a GUI " & $MyGravatar, 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered Local $idPic = GUICtrlCreatePic($MyGravatar, 50, 50, 80, 80) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;FileDelete($MyGravatar) ; Delete the file. FileDelete($sFilePath) EndFunc ;==>GetAvatar Now, here is the issue. If I use the example from the Gravatar site, located here: http://en.gravatar.com/site/implement/images/ Then this code 205e460b479e2e5b48aec07710c08d50 downloads this pic (not me) AND it displays correctly. PROBLEM However, If I download my own Gravatar, I see the image in the @Script folder, BUT IT DOES NOT DISPLAY. The same with the retro image. To be clear, this image downloads, but is not displayed. I guess it has something to do with the format of my gravatar. Or that the display funtion GUICtrlCreatePic() does not like my gravatar. I would be grateful if someone would be willing to test this and may offer a suggestion or two... Skysnake
-
Tell me, please, why in the application of different styles($SS_BLACKFRAME, $SS_BLACKRECT, etc.) of frames stops working function Msg(). And why in the application of certain frame styles($SS_BLACKFRAME) do not even picture displayed? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) Example() Func Example() GUICreate("My GUI picture", 350, 300, -1, -1) ; will create a dialog box that when displayed is centered GUISetOnEvent($GUI_EVENT_CLOSE,"Quit") $idPic = GUICtrlCreatePic("D:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 200, 50, $SS_SUNKEN) GUICtrlSetOnEvent(-1,"Msg") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 WEnd EndFunc ;==>Example Func Msg() MsgBox(0,0,0) EndFunc Func Quit() Exit EndFunc
- 16 replies
-
- guictrlcreatepic
- guictrlsetonevent
-
(and 1 more)
Tagged with:
-
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> Global $bChanged = False $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xE0FFFF) $Pic = GUICtrlCreatePic(@ScriptDir&"your_background.jpg", 0, 0, 1024, 600) GUICtrlSetState(-1, $GUI_DISABLE) $cLV = GUICtrlCreateListView("Column 1", 10, 10, 200, 200) $hLV = GUICtrlGetHandle($cLV) For $i = 0 To 19 GUICtrlCreateListViewItem("Item " & $i, $cLV) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If $bChanged Then $j = _GUICtrlListView_GetSelectedIndices($hLV) ConsoleWrite($j & @CRLF) $bChanged = False EndIf WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hLV $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK $tStruct = DllStructCreate($tagNMITEMACTIVATE, $lParam) $Index = DllStructGetData($tStruct, "Index") Local $iItemText = _GUICtrlListView_GetItemText($cLV,DllStructGetData($tStruct, "Index"),1) $item = StringSplit(_GUICtrlListView_GetItemTextString($cLV, $Index),'|') $item = $item[1] ConsoleWrite($item & @CRLF) GUICtrlSetImage($Pic,@ScriptDir&"your_background.jpg") Case $LVN_KEYDOWN $tStruct = DllStructCreate($tagNMLVKEYDOWN, $lParam) $iKey = DllStructGetData($tStruct, "VKey") Switch $iKey Case 38 ; Up, Down $bChanged = True GUICtrlSetImage($Pic,@ScriptDir&"your_background.jpg") Case 40 $bChanged = True GUICtrlSetImage($Pic,@ScriptDir&"your_background.jpg") EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY I created a listview with icons and click control to change the background and works very well, I tried to enter the up and down controls, but in this case the listview disappears , you know how to fix it. my script is long so.. I copied an example from the forum "Melba" and added the necessary just to show you. THX
-
Hi all i need to create some picture (1000 plus) in GUI i want to use variable like $n do $n=$n+1 Local $iPic & $n = GUICtrlCreatePic("", $x, $y, 50, 50) until $n = 1000 but i receive this error No variable given for "Dim", "Local", "Global", "Struct" or "Const" statement. Please help me, thanks
-
Here's a simple script I'm testing the ScreenCapture function with. #include <ScreenCapture.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> ; Capture region _ScreenCapture_Capture(@ScriptDir & "\image.bmp", 290,18,1465,652,0) $form=GUICreate("Test",1175,634,290,18,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_COMPOSITED) $PSimage=GUICtrlCreatePic(@ScriptDir & "\image.bmp", 0,0,1175,634) GUISetState(@SW_SHOW) MsgBox(0,"","Test of screen cap and display.") . The above script captures an area of the screen (the SciTE editor with this script open), writes it to image.bmp, and displays image.bmp. The problem I'm having is when image.bmp is displayed using GUICtrlCreatePic the result is fuzzy. Here's a SnagIt screen capture of what GUICtrlCreatePic displays. Attached is image.bmp, which is sharp and equivalent to seeing the actual script open in SciTE on-screen. Any suggestions for displaying an accurate rendition of ScreenCapture's output? (Must be borderless, no chrome, etc. -- equivalent to what my test script yields.) image.bmp
-
To save future readers a little sweat I'm editing my original post to insert the following: After trying various suggested scripting approaches, some of which introduced new problems and some which had the same problem described here, I tried my script and a few others on another computer. No white flashes, tears, glitches. So I brought it back to my main box and disabled the Intel GPU that was feeding a 3rd monitor. Down to two monitors connected to a single NVidia GPU the visual glitches disappeared. Who would'a thought?! That said, some of the replies that follow provide valuable insights into the various ways to skin this cat using AutoIt. Some suggested scripts introduced new problems so they might be instructive about approaches to avoid. Ultimately, JohnOne suggested an elegantly simple script that perfectly accomplishes my goal. --------------------- I want to display a 800x600 picture (i.e., not full-screen) without a border, close-box, title, etc. I then want to replace that picture with another one -- cleanly. Think of an old-fashioned dual-projector slide show where there's no black-out or other interruption to the image on screen. This way I can start with a background image, then add elements to it seamlessly (once called "a build", i.e., pseudo-animation). The image format doesn't matter to me. I can't use an animated GIF or video because my code is doing things in the background between images, so timing varies. I'm having bad luck using an AutoIt form to accomplish this (GUICtrlCreatePic, followed by subsequent GUICtrlSetImage's). The result is a glitch -- usually a white flash or tear in the picture -- at almost every image change. (see 10/10/13 post entitled "random visual glitch when using GUICtrlSetImage"). So I guess that's out. SplashImageOn blanks out the first image before displaying the next (like a single-projector slide show), so it's not seamless -- plus there's still a tiny border visible. $var = Default SplashImageOn("","image1.bmp",$var,$var,$var,$var,1) sleep(2000) SplashImageOn("","image2.bmp",$var,$var,$var,$var,1) sleep(2000) SplashImageOn("","image3.bmp",$var,$var,$var,$var,1) sleep(2000) Any suggestions?
- 17 replies
-
I found the following code in a forum post by newbiescripter, which displays a transparent gif "crosshair". #include <WindowsConstants.au3> $x = @DesktopWidth/2 - 13/2 $y = @DesktopHeight/2 - 13/2 GUICreate("", 13, 13, $x, $y, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUICtrlCreatePic("target.gif",0,0,13,13) GUISetState() Sleep(3000) It works great... with the gif file included in newbiescripter's post. I was able to modify the gif in CS6 for my needs but I'm really curious why another gif that I created from scratch in CS6 does not display with transparency in the same script. (I know how to create transparent gifs, and mine opens in CS6 with transparency intact.) I'm probably just knackered from long hours but I give up and submit my question here despite the probability of embarrassment. See attached. "Crosshair.gif" is the one that works. "Target.gif" is the one that doesn't. "Target.psd" is the original PSD file. (oops, not allowed)
- 5 replies
-
- GIF
- Transparency
-
(and 1 more)
Tagged with:
-
post deleted due to no responses and subsequent findings re bmp file rendering
-
My originaly script where I was noticing this issue was quite long, so I trimmed it down considerably (93 lines to 5) to show the example issue. From what I've noticed in related topics, it's never really been solved (at least from my searches), and it unfortunately seems to not show up on all machines. Description: It seems that when using GUICtrlCreatePic() alongside GuiSetBkColor() the embedded image will get transparent artifacts. It seems as though it's light colors only - as to what colors/shades, I cannot say. Other topics: March 2012: -- April 2010 -- July 2012 -- (not actually solved) March 2005 -- Hopefully this has been solved and my searching is just lacking... ; Window $kiosk = GUICreate("", @DesktopWidth, @DesktopHeight) GuiSetBkColor("0x000000") ; Background image GUICtrlCreatePic("image.jpg", 0, 0, 640, 480) ; --- Display the Coded Form --- ; GUISetState(@SW_SHOW) Sleep(2000) Example image file used is attached, as well as a screenshot of the window as rendered on my machine (Win7 Pro x64). To be fair I'm currently running v3.3.6.1. After I post this I'll upgrade and check the current version to see if it fixes the problem(s). The "transparent_pixelation.jpg" file shows a line through the example input image. Around the "white" circle of the image there are also areas of black pixels that don't exist in the original. I'm not too familiar with using image or form functions in AutoIt (I primarily use it to automate actions) so if anyone has any ideas I'm willing to give it a shot.
- 7 replies
-
- GUICtrlCreatePic
- transparent
-
(and 4 more)
Tagged with:
-
Screenshot attached! I have a background image where all the buildings are black. When the distribution switches in the buildings respond to a ping, the buildings turn green. Dim $hImgMain = GUICtrlCreatePic("img\fullmap-nologo.gif",0,0,768,635) Dim $hImgAud = GUICtrlCreatePic("",263,287,36,27) Dim $hImgBus = GUICtrlCreatePic("",181,321,97,28) Dim $hImgCtr = GUICtrlCreatePic("",181,239,97,82) ... If ping($sIpAud) Then GUICtrlSetImage($hImgAud,"img\Green-Aud.gif") I'd like each building to have a context menu: $hMenuAud = GUICtrlCreateContextMenu($hImgAud) $hMenuAud1 = GUICtrlCreateMenu("Switch1",$hMenuAud) $hMenuAud1Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud1) $hMenuAud1Web = GUICtrlCreateMenuItem("Web",$hMenuAud1) $hMenuAud2 = GUICtrlCreateMenu("Switch2",$hMenuAud) $hMenuAud2Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud2) $hMenuAud2Web = GUICtrlCreateMenuItem("Web",$hMenuAud2) but the menus don't show up. Neither do tooltips. I'm sure this is something simple, but I've never really done anything like this before. Thanks!
- 2 replies
-
- pic
- context menu
-
(and 2 more)
Tagged with:
-
I am facing this problem while trying to make a metro UI Sidebar, tried to fix it all night but couldnt, problem is that whenever I use a colored background (whether a stretched disabled pic in BG or using GUISetBkColor) the pic placed in the gui using GUICtrlCreatePic() shows some distortion on the runtime, I have attached all the image files, au3, and a screen shot. Please help me out fixing this distortion problem, Thanks in advance. Sincerely, A helpless Person (Needs help asap) Distortion Help.rar
-
Hi all I am wondering if someone knows what could be causing the images in my GUI to display little black squares all over them. They seem to change depending on how much code is in the file/program. I have attached two examples, the first is from a set of buttons called using GUICtrlCreatePic and they are in BMP format Shows a screenshot of the GUI image on the left and the original images on the right The second is also called using GUICtrlCreatePic but they are in JPG format Shows a screenshot of the GUI image on the top and the original image on the bottom Both of them display the same problem although in earlier versions of the code it seemed to just exist on the BMP buttons, although i havent been watching it closely until i noticed them in both places today. They show up whether the script is compiled or not. Thanks in advance Adam
-
I'm trying to displaya picture on a gui but it doesn't work if I make some GDI+ operations just before creating the gui: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> #include <StaticConstants.au3> Local $GUIimg_title,$GUIwidth,$GUIheight,$GUILeft,$GUITop Local $filename = FileOpenDialog("Select image", @ScriptDir, "Image (*.jpg;*.bmp)", 3) _GDIPlus_Startup() Local $imagefromfile = _GDIPlus_ImageLoadFromFile($filename) ;Create an image object based on a file Local $GUIwidth = _GDIPlus_ImageGetWidth($imagefromfile) Local $GUIheight = _GDIPlus_ImageGetHeight($imagefromfile) ; Display image $hBitmap_GUI = GUICreate("", $GUIwidth, $GUIheight) $hPic = GUICtrlCreatePic($filename, 0, 0) GUISetState() _GDIPlus_Shutdown() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE;, $hCancel_Button Exit ;~ EndSwitch WEnd Instead it works if I remove GDI+ ... Can't understand why! #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> #include <StaticConstants.au3> Local $GUIimg_title,$GUIwidth,$GUIheight,$GUILeft,$GUITop Local $filename = FileOpenDialog("Select image", @ScriptDir, "Image (*.jpg;*.bmp)", 3) ;~ _GDIPlus_Startup() ;~ Local $imagefromfile = _GDIPlus_ImageLoadFromFile($filename) ;Create an image object based on a file ;~ Local $GUIwidth = _GDIPlus_ImageGetWidth($imagefromfile) ;~ Local $GUIheight = _GDIPlus_ImageGetHeight($imagefromfile) ;~ _GDIPlus_Shutdown() ; Display image ;$hBitmap_GUI = GUICreate("", $GUIwidth, $GUIheight) $hBitmap_GUI = GUICreate("", 800, 800); <---- had to use fixed size... $hPic = GUICtrlCreatePic($filename, 1, 1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE;, $hCancel_Button Exit ;~ EndSwitch WEnd Any hints?
- 2 replies
-
- guictrlcreatepic
- gdi+
-
(and 1 more)
Tagged with:
-
I have a program consisting of 5 .au3-files, one is the main functions, one the GUI functions, and the other are various functions I mostly separate to avoid scrolling when editing (and instead changing tabs). In the GUI file I have GUICtrlCreatePic("P1050652.JPG", -1, -1, 1200, 450) GUICtrlSetState(-1, $GUI_DISABLE) (and the file P1050652.JPG exists and is without errors). If I double click the main .au3-file everything is fine and I get to see the background picture. If I create a shortcut, and double click this, all is fine. If I pin AutoIt to the taskbar, and then pin the main file to this icon, then the GUI is grey (no picture) when it runs. Why don't I see the picture when the file is called via a pinned shortcut? If I compile the program I see the picture. If I pin the compiled version to the taskbar I see the picture. Since using the pin to pinned icon version of starting the program is the easiest, I'd prefer for this to work as well. Other than that I'm mostly curious to why the behaviour varies.
-
Seems using GUICtrlSetImage with a empty string resets not only the image but also the initial image size on a GUICtrlCreatePic control. Ergo: GUICtrlSetImage next use, with a valid image, will display the image in its original size instead of the initial size used at the GUICtrlCreatePic creation time. ... that's it. --- Code wise example/explanation. GUICreate('MyGUI') ; $PicCtrl = GUICtrlCreatePic('MyImage_Initial.ext') GUISetState() ; GUICtrlSetImage($PicCtrl, 'MyImage_2.ext') ;; 'MyImage_2.ext' will be rescaled/displayed using the 'MyImage_Initial.ext' image dimensions. ; GUICtrlSetImage($PicCtrl, '') ;; Clear active 'MyImage_Initial.ext' image dimensions on $PicCtrl. ; GUICtrlSetImage($PicCtrl, 'MyImage_3.ext') ;; Set new image dimensions, based on 'MyImage_3.ext' image dimentions.