| 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, 4) & ")", 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_SetFont($g_hRichEdit, 15, "Times New Roman", $ANSI_CHARSET) |
|---|
| 32 | Report("2. Set Font") |
|---|
| 33 | GUICtrlSetState($idBtnNext, $GUI_DISABLE) |
|---|
| 34 | EndSwitch |
|---|
| 35 | EndSelect |
|---|
| 36 | WEnd |
|---|
| 37 | EndFunc ;==>Example |
|---|
| 38 | |
|---|
| 39 | Func Report($sMsg) |
|---|
| 40 | Local $aRet = _GUICtrlRichEdit_GetFont($g_hRichEdit) |
|---|
| 41 | $sMsg = $sMsg & @CRLF & @CRLF & $aRet[1] & " " & $aRet[0] & " points" |
|---|
| 42 | GUICtrlSetData($g_idLblMsg, $sMsg) |
|---|
| 43 | EndFunc ;==>Report |
|---|