Jump to content

Winmove to full screen and fontsize


MightyWeird
 Share

Recommended Posts

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 by MightyWeird
Link to comment
Share on other sites

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

  • 2 months later...

 

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 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

  • Moderators

MightyWeird,

The code in this thread should help you.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...