Function Reference


_GUICtrlRichEdit_SetZoom

Sets zoom level of the control

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetZoom ( $hWnd, $iPercent )

Parameters

$hWnd Handle to the control
$iPercent percentage zoom
values: 100 and 200 to 6400

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero.
@error: 101 - $hWnd is not a handle
1021 - $iPercent is not a positive number
1022 - $iPercent neither 100 nor in the range 200 to 6400

Remarks

MSDN claims that EM_SETZOOM works from 1.56% (1/64) to 6400% (64/1) but testing shows that it only works reliably for the values shown above.

Related

_GUICtrlRichEdit_GetZoom

See Also

Search EM_SETZOOM in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $g_idLblMsg

Example()

Func Example()
        Local $hGui = GUICreate("RichEdit Get/Set Zoom (v" & @AutoItVersion & ")", 360, 350, -1, -1)
        Local $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 340, 220, _
                        BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
        $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
        Local $idBtnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
        GUISetState(@SW_SHOW)

        _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is appended text.")

        Local $iMsg, $iStep = 0
        While True
                $iMsg = GUIGetMsg()
                Select
                        Case $iMsg = $GUI_EVENT_CLOSE
                                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                                ; GUIDelete()   ; is OK too
                                Exit
                        Case $iMsg = $idBtnNext
                                $iStep += 1
                                Switch $iStep
                                        Case 1
                                                Report("1.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
                                        Case 2
                                                _GUICtrlRichEdit_SetZoom($hRichEdit, 250)
                                                Report("2.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
                                                GUICtrlSetState($idBtnNext, $GUI_DISABLE)
                                EndSwitch
                EndSelect
        WEnd
EndFunc   ;==>Example

Func Report($sMsg)
        GUICtrlSetData($g_idLblMsg, $sMsg)
EndFunc   ;==>Report