ronaldo97 Posted January 15, 2017 Posted January 15, 2017 (edited) Hello How can I make the GUI is compatible with all screen sizes ?? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 623, 445, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZE)) GUISetBkColor(0x1E1E1E) $Label1 = GUICtrlCreateLabel("Welcome Back !!", 424, 64, 161, 29) GUICtrlSetFont(-1, 16, 400, 0, "Tahoma") GUICtrlSetColor(-1, 0x800000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How do I make Gui interface compatible with all screen sizes ?? 800*600 1024*768 1280*1024 Edited January 15, 2017 by ronaldo97
Moderators Melba23 Posted January 15, 2017 Moderators Posted January 15, 2017 ronaldo97, The @DeskTopWidth & @DeskTopHeight macros will give you the screen size - you then need to calculate what size and position you require for the GUI. Create the GUI at full size and use GUICtrlSetResizing on the controls (or use Opt("GUIResizeMode")) so that the controls will resize as well. Then resize and move the GUI like this: ; Set GUI to required position and size GUISetState(@SW_HIDE) WinMove($hGUI, "", $iMain_X, $iMain_Y, $iMain_W, $iMain_H) GUISetState(@SW_SHOW) Please ask if you have any questions. M23 ronaldo97 1 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
ronaldo97 Posted January 15, 2017 Author Posted January 15, 2017 (edited) 5 hours ago, Melba23 said: ronaldo97, The @DeskTopWidth & @DeskTopHeight macros will give you the screen size - you then need to calculate what size and position you require for the GUI. Create the GUI at full size and use GUICtrlSetResizing on the controls (or use Opt("GUIResizeMode")) so that the controls will resize as well. Then resize and move the GUI like this: ; Set GUI to required position and size GUISetState(@SW_HIDE) WinMove($hGUI, "", $iMain_X, $iMain_Y, $iMain_W, $iMain_H) GUISetState(@SW_SHOW) Please ask if you have any questions. M23 Thank hou very much !! Please explain to me possible video ?? Edited January 15, 2017 by ronaldo97
Moderators Melba23 Posted January 15, 2017 Moderators Posted January 15, 2017 ronaldo97, Quote Please explain to me possible video? Why do you need a video? Just run this: expandcollapse popup#include <GUIConstantsEx.au3> ; Get controls to resize with the GUI Opt("GUIResizeMode", $GUI_DOCKAUTO) ; Get screen size $iScreenWidth = @DesktopWidth $iScreenHeight = @DesktopHeight ; Calculate required size and position $iGUIX = 100 $iGUIY = 100 $iGUIWidth = $iScreenWidth - ($iGUIX * 2) $iGUIHeight = $iScreenHeight - ($iGUIY * 2) ; Create GUI for assumed "normal" case $hGUI = GUICreate("Test", 500, 500) $cLabel = GUICtrlCreateLabel("This is the GUI at the size you created", 10, 10, 250, 50) GUICtrlSetBkColor($clabel, 0xFFCCCC) $cButton = GUICtrlCreateButton("Press me to resize the GUI", 10, 400, 150, 50) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton GUICtrlSetData($cLabel, "See how everything in the GUI" & @CRLF & "is resized along with the GUI?") ; Resize and relocate GUI as required WinMove($hGUI, "", $iGUIX, $iGUIY, $iGUIWidth, $iGUIHeight) EndSwitch WEnd 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
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