wzsmith Posted March 9, 2010 Share Posted March 9, 2010 Thanks ahead with for the help. I'm trying to create an image file that will be centered at the top of a window and will not be resized from it's original dimensions. Is it something to do with the window style? I'm creating an app launcher for a kiosk style setup that I don't want users to be able to close and setting the style to $WS_POPUP removes the user's ability to close or resize the window. The reason I need the jpeg to reposition itself is that I plan to have the size of the windows change dynamically according to the current screen resolution. I'm using 1024x768 right now to test, as it's the most common and I have the image sized to be 800px wide as 800x600 is the smallest resolution I plan to support. Once this is done, I'll have a row of buttons down the center of the form to launch various apps and a timer that will close them all after a certain period if there has been no activity. My code looks something like: $wdoMain=GUICreate("Window",1024,768,1,1,$WS_POPUP) GUISetBKColor(0x083368) ;I've tried various things here with no luck $title = GUICtrlCreatePic("pic.jpeg",1,1,0,0) GUICtrlSetResizing($title,$GUI_DOCKAUTO) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2010 Moderators Share Posted March 9, 2010 wzsmith, Welcome to the AutoIt forum. You need to do some basic maths to work out where to put the picture on your GUI. Like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $aPos $hGUI = GUICreate("Test", 500, 500, Default, Default, $WS_POPUP) $hPic = GUICtrlCreatePic("Your_Pic_Path_Here", 0, 0) $aPos = ControlGetPos($hGUI, "", $hPic) _Set_Pic(500) GUISetState() Sleep(5000) WinMove($hGUI, "", Default, Default, 200, 200) _Set_Pic(200) Sleep(5000) WinMove($hGUI, "", Default, Default, 300, 600) _Set_Pic(300) Sleep(5000) WinMove($hGUI, "", Default, Default, 600, 200) _Set_Pic(600) Sleep(5000) Exit Func _Set_Pic($iGUI_Width) GUICtrlSetPos($hPic, ($iGUI_Width - $aPos[2]) / 2, 0, $aPos[2], $aPos[3]) EndFunc I hope this helps - ask if anything is unclear. M23 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 Link to comment Share on other sites More sharing options...
wzsmith Posted March 9, 2010 Author Share Posted March 9, 2010 You need to do some basic maths to work out where to put the picture on your GUI.I see where you're going. I should be able to use @desktopheight and @desktopwidth to size the window, then position things from there. I was hoping that I could automatically have the controls center themselves, similar to the dock functions in VB. This will work fine though. Thanks for the info. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2010 Moderators Share Posted March 9, 2010 wzsmith, Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $aPos $hGUI = GUICreate("Test", 500, 500, Default, Default, $WS_POPUP) $hPic = GUICtrlCreatePic("M:\Program\Au3 Scripts\Images\Melba23.jpg", 0, 0) GUICtrlSetResizing ( $hPic, $GUI_DOCKHCENTER + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT ) $aPos = ControlGetPos($hGUI, "", $hPic) GUICtrlSetPos($hPic, (500 - $aPos[2]) / 2, 0, $aPos[2], $aPos[3]) GUISetState() Sleep(5000) WinMove($hGUI, "", Default, Default, 200, 200) Sleep(5000) WinMove($hGUI, "", Default, Default, 300, 600) Sleep(5000) WinMove($hGUI, "", Default, Default, 600, 200) Sleep(5000) Exit I forgot that you can set resizing to the vertical and horizontal centres. Makes it a lot simpler! M23 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 Link to comment Share on other sites More sharing options...
wzsmith Posted March 10, 2010 Author Share Posted March 10, 2010 That's got me rolling, thanks! 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