1 | #include <GUIConstantsEx.au3> |
---|
2 | #include <GuiRichEdit.au3> |
---|
3 | #include <WindowsConstants.au3> |
---|
4 | |
---|
5 | Global $g_idLblMsg, $g_hRichEdit |
---|
6 | |
---|
7 | Example() |
---|
8 | |
---|
9 | Func Example() |
---|
10 | Local $hGui, $iMsg, $idBtnNext, $iStep = 0 |
---|
11 | $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) |
---|
12 | $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ |
---|
13 | BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) |
---|
14 | $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60) |
---|
15 | $idBtnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30) |
---|
16 | GUISetState(@SW_SHOW) |
---|
17 | |
---|
18 | While True |
---|
19 | $iMsg = GUIGetMsg() |
---|
20 | Select |
---|
21 | Case $iMsg = $GUI_EVENT_CLOSE |
---|
22 | _GUICtrlRichEdit_Destroy($g_hRichEdit) ; needed unless script crashes |
---|
23 | ; GUIDelete() ; is OK too |
---|
24 | Exit |
---|
25 | Case $iMsg = $idBtnNext |
---|
26 | $iStep += 1 |
---|
27 | Switch $iStep |
---|
28 | Case 1 |
---|
29 | Report("1. Initial") |
---|
30 | Case 2 |
---|
31 | _GUICtrlRichEdit_SetSel($g_hRichEdit, 0, 5) |
---|
32 | _GUICtrlRichEdit_SetFont($g_hRichEdit, 15, "Times New Roman") |
---|
33 | Report("2. Set Font") |
---|
34 | GUICtrlSetState($idBtnNext, $GUI_DISABLE) |
---|
35 | EndSwitch |
---|
36 | EndSelect |
---|
37 | WEnd |
---|
38 | EndFunc ;==>Example |
---|
39 | |
---|
40 | Func Report($sMsg) |
---|
41 | Local $aRet = _GUICtrlRichEdit_GetFont($g_hRichEdit) |
---|
42 | $sMsg = $sMsg & @CRLF & @CRLF & $aRet[1] & " " & $aRet[0] & " points" |
---|
43 | GUICtrlSetData($g_idLblMsg, $sMsg) |
---|
44 | EndFunc ;==>Report |
---|