函数参考


_GUICtrlRichEdit_GetSpaceUnit

获取水平和垂直空间计算单位,供 _GUICtrlRichEdit 函数的参数使用

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetSpaceUnit()

参数

None.

返回值

返回
"in", "cm", "mm", "pt" (points), 或 "tw" (缇, 1/1440 英寸, 1/567 厘米)

注意/说明

 初始空间测量单位为英寸

相关

_GUICtrlRichEdit_SetSpaceUnit

示例/演示


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

Global $lblMsg, $hRichEdit

Main()

Func Main()
    Local $hGui, $iMsg, $btnNext, $iStep = 0
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    $lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    $btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
    GUISetState()

    _GUICtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; 除非脚本崩溃才需要
;~              GUIDelete()     ; 同样行
                Exit
            Case $iMsg = $btnNext
                $iStep += 1
                Switch $iStep
                    Case 1
                        Report("1. Initial setting")
                    Case 2
                        _GUICtrlRichEdit_SetSpaceUnit("cm")
                        Report("2. Setting is now")
                        GUICtrlSetState($btnNext, $GUI_DISABLE)
                EndSwitch
        EndSelect
    WEnd
EndFunc   ;==>Main

Func Report($sMsg)
    $sMsg = $sMsg & @CR & _GUICtrlRichEdit_GetSpaceUnit()
    GUICtrlSetData($lblMsg, $sMsg)
    ControlFocus($hRichEdit, "", "")
EndFunc   ;==>Report