设置左、右边距的宽度
#include <GuiEdit.au3>
_GUICtrlEdit_SetMargins($hWnd [, $iMargin = 0x1 [, $iLeft = 0xFFFF [, $iRight = 0xFFFF]]])
$hWnd | 控件的控件ID/句柄 |
$iMargin | [可选参数] 可以是下列一或多个值: $EC_LEFTMARGIN - 设置左边距 $EC_RIGHTMARGIN - 设置右边距 |
默认: $EC_LEFTMARGIN 设置左边距 | |
$iLeft | [可选参数] 左边距宽度 |
默认: $EC_USEFONTINFO | |
$iRight | [可选参数] 右边距宽度 |
默认: $EC_USEFONTINFO |
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Debug_Ed = False ; 检查传递给 Edit 函数的类名, 设置为真并使用另一控件的句柄可以看出它是否有效
_Main()
Func _Main()
Local $hStatusBar, $hEdit, $hGUI
Local $sWow64 = ""
If @AutoItX64 Then $sWow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\_ReadMe_.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aMargins
; 创建 GUI
$hGUI = GUICreate("Edit Set Margins", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($hStatusBar, 2, 97, "shell32.dll")
GUISetState()
; 设置边距
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)
; 设置文本
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
; 获取边距
$aMargins = _GUICtrlEdit_GetMargins($hEdit)
_GUICtrlStatusBar_SetText($hStatusBar, "Left Margin: " & $aMargins[0])
_GUICtrlStatusBar_SetText($hStatusBar, "Right Margin: " & $aMargins[1], 1)
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main