1. Trang chủ
  2. » Công Nghệ Thông Tin

AutoI Technology Curriculum Book part 51 ppt

7 176 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Nội dung

EndFunc ;==>Example Function Reference GUICtrlCreateRadio tạo một Radio button control cho GUI. GUICtrlCreateRadio ( "text", left, top [, width [, height [, style [, exStyle]]]] ) Parameters text text hiện trị sẵn trên control 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 : $BS_AUTORADIOBUTTON and $WS_TABSTOP if first radio in the group. 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 để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_RADIO, newstyle, ). để có thể dùng đc các biến trên ta cần phải khai báo thư viện #include <ButtonConstants.au3> in your script. Default resizing is $GUI_DOCKHEIGHT. Related GUICoordMode (Option), GUICtrlSet , GUIGetMsg Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $radio1, $radio2, $msg GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered $radio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 120, 20) $radio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 120, 20) GUICtrlSetState($radio2, $GUI_CHECKED) GUISetState() ; will display an dialog box with 1 checkbox ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.') Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.') EndSelect WEnd EndFunc ;==>Example Function Reference GUICtrlCreateSlider tạo một Slider control cho GUI. GUICtrlCreateSlider ( left, top [, width [, height [, style [, exStyle]]]] ) Parameters left X top Y width W height H style kiểu, xem GUI Control Styles Appendix. default (-1) : $TBS_AUTOTICKS 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 để thay đổi giá trị ta dùng GUICtrlSetData. để đặt giá trị to nhất và nhỏ nhất ta dùng GUICtrlSetLimit. để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_SLIDER, newstyle, ). để có thể dùng đc các biến trên ta cần phải khai báo thư viện #include <SliderConstants.au3> in your script. Default resizing is $GUI_DOCKAUTO size and position will occur. Related GUICoordMode (Option), GUICtrlSetData, GUICtrlSetLimit, GUICtrlSet , GUIGetMsg Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $slider1, $button, $msg GUICreate("slider", 220, 100, 100, 200) GUISetBkColor(0x00E0FFFF) ; will change background color $slider1 = GUICtrlCreateSlider(10, 10, 200, 20) GUICtrlSetLimit(-1, 200, 0) ; change min/max value $button = GUICtrlCreateButton("Value?", 75, 70, 70, 20) GUISetState() GUICtrlSetData($slider1, 45) ; set cursor Do $msg = GUIGetMsg() If $msg = $button Then MsgBox(0, "slider1", GUICtrlRead($slider1), 2) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Function Reference GUICtrlCreateTab tạo một Tab control cho GUI. GUICtrlCreateTab ( left, top [, width [, height [, style [, exStyle]]]] ) Parameters left X top Y width W height H style kiểu, xem GUI Control Styles Appendix. default ( -1) : none. forced styles : $WS_TABSTOP, $WS_CLIPSIBLINGS exStyle kiểu mở rộng, xem Extended Style Table. Return Value Success: trả lại ControlID Failure: Returns 0. Remarks mọi control đc tạo trong tabitem sẽ thuộc tabitem đó (giống như group ý) để thay đổi giá trị ta dùng GUICtrlSet để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_TAB, newstyle, ). để có thể dùng đc các biến trên ta cần phải khai báo thư viện #include <TabConstants.au3> in your script. Default resizing is $GUI_DOCKSIZE. Related GUICtrlCreateTabItem, GUICoordMode (Option), GUICtrlCreate , GUICtrlSet , GUIGetMsg Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example()

Ngày đăng: 07/07/2014, 01:20