MightyWeird Posted September 8, 2021 Share Posted September 8, 2021 (edited) Hi, I have a gui set at 800*600 Then I use winmove to set the gui to @desktopheight and @desktopwidth Everything looks nice (not perfect), but it works except the text in my buttons and labels keep the same size Is there a way to set the font higher based on the new resolution after winmove to the new resolution. I searched and found several possible solutions (for example the _FindMaxSize function) , but maybe I am missing the point, or it does not work after a the winmove. Thank you Edited September 8, 2021 by MightyWeird Link to comment Share on other sites More sharing options...
kjpolker Posted September 15, 2021 Share Posted September 15, 2021 Unless I don't understand correctly you can use GUICtrlSetFont() #include <GUIConstantsEx.au3> $window = GuiCreate("List", 280, 240) $button = GUICtrlCreateButton("Resize", 115, 210, 50, 21) $label = GUICtrlCreateLabel("8.5 size font (default)", 100, 100) GUISetState() $TaskBar = WinGetClientSize("[CLASS:Shell_TrayWnd]") While 1 Switch GUIGetMsg() Case $GUI_EVENT_Close Exit Case $button Resize() EndSwitch WEnd Func Resize() WinMove($window, "", 0, 0, @DesktopWidth, @DesktopHeight - $TaskBar[1]) GUICtrlSetData($label, "16 size font") GUICtrlSetFont($label, 16) EndFunc Or look into GUICtrlSetResizing() Link to comment Share on other sites More sharing options...
ad777 Posted December 6, 2021 Share Posted December 6, 2021 (edited) Quote I searched and found several possible solutions (for example the _FindMaxSize function) , but maybe I am missing the point, or it does not work after a the winmove. Thank you i hope this help ya ex: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $gui Global $newwidth Global $label1 Example() Func Example() Opt("GUICoordMode", 2) $gui = GUICreate("My InputBox", 190, 114, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; start the definition Global $Width = WinGetClientSize($gui)[0] Global $Height = WinGetClientSize($gui)[1] GUISetFont(8, -1, "Arial") $label1 = GUICtrlCreateLabel("Prompt", 8, 7) ; add prompt info GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP) GUISetState(@SW_SHOW) ; to display the GUI ; Loop until the user exits. While 1 _ResizeFont() Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example Func _ResizeFont() if $Width <> WinGetClientSize($gui)[0] Then ;;;;;;;here you can change size of font!! GUICtrlSetFont($label1,WinGetClientSize($gui,"")[1]/15,2,"Arial") $newwidth = WinGetClientSize($gui)[0] $Width = $newwidth EndIf EndFunc another ex: #include <GUIConstantsEx.au3> $window = GuiCreate("List", 280, 240) $button = GUICtrlCreateButton("Resize", 115, 210, 50, 21) $label = GUICtrlCreateLabel("8.5 size font (default)", 100, 100) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_Close Exit Case $button WinMove($window, "", 0, 0, @DesktopWidth, @DesktopHeight ) GUICtrlSetData($label, "16 size font") GUICtrlSetFont($label, WinGetClientSize($window,"")[1]/15) EndSwitch WEnd Edited December 6, 2021 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 6, 2021 Moderators Share Posted December 6, 2021 MightyWeird, The code in this thread should help you. M23 MightyWeird 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 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