Tải bản đầy đủ (.pdf) (6 trang)

Giáo Trình How To Use AutoIt A Professional Manner part 39 ppsx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (72.95 KB, 6 trang )

exStyle kiểu mở rộng. xem Extended Style Table.

Return Value
Success:

trả lại controlID
Failure:

Returns 0.

Remarks
để lấy giá trị của control ta dùng GUICtrlRead.
để đặt các thuộc tính cho control ta dùng GUICtrlSet

Để đoạn video đc chạy luôn ngay sau khi control được tạo ra sử dụng kiểu
$ACS_AUTOPLAY.
bạn có thể bắt đầu chạy hay dùng đoạn video bằng hàm GUICtrlSetState với state
= 1 và 0.

để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_AVI,
newstyle, ).

để có thể dùng đc các biến trên ta cầnphair khai báo thư viện #include
<AVIConstants.au3>

mặc định là $GUI_DOCKSIZE.
Related
GUICoordMode (option), GUICtrlSet , GUIGetMsg
Example

#include <GUIConstantsEx.au3>



Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $ani1, $buttonstart, $buttonstop, $msg

GUICreate("My GUI Animation", 300, 200)
$ani1 = GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 165, 50, 10)

$buttonstart = GUICtrlCreateButton("start", 50, 150, 70, 22)
$buttonstop = GUICtrlCreateButton("stop", 150, 150, 70, 22)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $buttonstart
GUICtrlSetState($ani1, 1)

Case $msg = $buttonstop
GUICtrlSetState($ani1, 0)


EndSelect
WEnd
EndFunc ;==>Example




Function Reference
GUICtrlCreateButton
tạo ra một nút ấn trên GUI.
GUICtrlCreateButton ( "text", left, top [, width [, height [, style [, exStyle]]]] )
Parameters
text dòng chữ hiện thị trên nút
left tọa độ X
top tọa độ Y
width chiều rộng
height chiều cao
style
kiểu. xem thêm GUI Control Styles Appendix.

default ( -1) : none.
forced styles : $WS_TABSTOP
exStyle kiểu mở rộng. xem Extended Style Table.

Return Value
Success:

trả lại ControlID
Failure:


Returns 0.

Remarks
để lấy giá trị của control ta dùng GUICtrlRead.
để đặt các thuộc tính cho control ta dùng GUICtrlSet
nút có thể hiện thị icon hay image bằng cách sử dụng kiểu $BS_ICON hoặc
$BS_BITMAP.
để đặt ảnh hay icon cho nút tao dùng hàm GUICtrlSetImage.

để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_BUTTON,
newstyle, ).

để có thể dùng đc các biến trên ta cầnphair khai báo thư viện #include
<ButtonConstants.au3>

Default resizing is $GUI_DOCKSIZE
Related
GUICoordMode (Option), GUICtrlSet , GUIGetMsg
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $Button_1, $Button_2, $msg
GUICreate("My GUI Button") ; will create a dialog box that when displayed is
centered


Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Button Test", 0, -1)

GUISetState() ; will display an dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
Run('Notepad.exe') ; Will Run/Open Notepad
Case $msg = $Button_2
MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button
2 being pressed
EndSelect
WEnd
EndFunc ;==>Example



Function Reference
GUICtrlCreateCheckbox
tạo ra một Checkbox cho GUI để tick vào.
GUICtrlCreateCheckbox ( "text", left, top [, width [, height [, style [, exStyle]]]] )
Parameters
text chữ hiện trị trên checkbox

left tọa độ X
top tọa độ Y
width chiều rộng
height chiều cao
style
kiểu. xem thêm GUI Control Styles Appendix.

default ( -1) : $BS_AUTOCHECKBOX.
forced styles : $WS_TABSTOP, and $BS_AUTOCHECKBOX if no
checkbox style defined.
exStyle kiểu mở rộng. xem Extended Style Table.

Return Value
Success:

trả lại ControlID
Failure:

Returns 0.

Remarks

×