選択されたテキストの属性を返します。
#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharAttributes($hWnd)
パラメータ
| $hWnd | コントロールのハンドル |
返し値
| 成功: | 3文字の文字列。1文字目と2文字目については以下のいずれかです: |
| bo - 太字 | |
| di - 無効。文字は影付きで表示されます [nd]。 | |
| em - エンボス [nd] | |
| hi - 非表示 | |
| im - インプリント [nd] | |
| it - 斜体 | |
| li - マウスがこの属性を持つテキストをポイントするとEN_LINKメッセージが送信されます。 | |
| ou - 縁取り [nd] | |
| pr - ユーザーが変更しようとするとEN_PROTECTメッセージが送信されます。 | |
| re - 修正マークがつきます [nd]。 | |
| sh - 影 [nd] | |
| sm - 1文字目小文字 [nd] | |
| st - 取り消し線 | |
| sb - 添字 [nd] | |
| sp - 上付き文字 [nd] | |
| un - 下線 | |
| 3文字目: + 全体に適用、~ 部分的に適用 | |
| 失敗: | ""を返し、@errorを設定します。 |
| @error: | 101 - $hWndがハンドルではありません。 |
| -1 - テキストが選択されていません。 |
注意
属性のいくつかはリッチエディットコントロールでは表示されません。上記のうち表示されないものには[nd]がついています。
関連
_GUICtrlRichEdit_SetCharAttributes
こちらも参照
MSDNライブラリでEM_GETCHARFORMATを検索して下さい。
例
#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $lblMsg, $hRichEdit
Main()
Func Main()
Local $hGui, $iMsg, $iCp1
$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)
GUISetState()
_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
$iCp1 = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp1, $iCp1 + 3)
Report("Character attributes at start of line 2 are " & _
_GuiCtrlRichEdit_GetCharAttributes($hRichEdit))
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main
Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report