schuc Posted June 20, 2020 Posted June 20, 2020 (edited) I am trying to embed a few images(jpg/gif/png) into my project so I don't have to have the files available on the system at runtime. Note that I plan to programmatically change the pictures based on current status so the picture in $picKeyFoundYes will not be static. So I put the following in the Compile->res add files->extra files tab: D:\Data\MyProgs\AutoIt\Update Tool\approved.jpg,images,ONE D:\Data\MyProgs\AutoIt\Update Tool\check.gif,images,TWO I would like to somehow pull each of these images and assign them to a picture control. Below is my attempt but it is not working. ; Load images ;~ $picKeyFoundYes = GUICtrlCreatePic("", 145, 160, 24, 24) (commented because this line is already above in script ;~ $hImage = _GUIImageList_Create(16, 16, 5, 1) $hImage = _GUIImageList_Create() If @Compiled Then _GUIImageList_Add($hImage, @ScriptFullPath, 1) _GUIImageList_Add($hImage, @ScriptFullPath, 2) mb(@error) Else _GUIImageList_Add($hImage, "approved.jpg") _GUIImageList_Add($hImage, "check.gif") mb(@error) ; How do I put one of the images from the imagelist in the picture control? ;~ GUICtrlSetImage($picKeyFoundYes, $hImage[0]) EndIf Maybe I'm just not referencing the two images in the $hImage image list properly. This seems like a basic task but I'm struggling so I would appreciate any guidance on it. Thanks all Edited June 20, 2020 by schuc
schuc Posted June 20, 2020 Author Posted June 20, 2020 I should note that at the top of the script in the AutoIt3Wrapper_GUI #Region, it added: #AutoIt3Wrapper_Res_File_Add=D:\Data\MyProgs\AutoIt\Update Tool\approved.jpg,images,ONE #AutoIt3Wrapper_Res_File_Add=D:\Data\MyProgs\AutoIt\Update Tool\check.gif,images,TWO ...so apparently the resources were added, but I don't know how to reference them and set the image to a picture control. Thanks for any assistance
schuc Posted June 20, 2020 Author Posted June 20, 2020 Update: I just discovered ResourcesEx and am implementing that and having success. The issue I have now is that my images are large and taking over the whole GUI. I see there is an option for resize, but that isn't doing anything for my JPG files it seems.
Musashi Posted June 20, 2020 Posted June 20, 2020 4 hours ago, schuc said: I am trying to embed a few images(jpg/gif/png) into my project so I don't have to have the files available on the system at runtime. You can also have a look at : file-to-base64-string-code-generator-v120-build-2020-06-05-embed-your-files-easily "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
schuc Posted June 20, 2020 Author Posted June 20, 2020 2 hours ago, Musashi said: You can also have a look at : file-to-base64-string-code-generator-v120-build-2020-06-05-embed-your-files-easily Thanks for your reply Musashi. I was able to get it all going with ResourcesEx. I wasn't able to get the bitmap to load so I just used the JPG version I had of the same and now all load and size to control properly.
Moderators Melba23 Posted June 20, 2020 Moderators Posted June 20, 2020 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team 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
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