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

AutoI Technology Curriculum Book part 60 ppsx

7 230 0

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

THÔNG TIN TÀI LIỆU

If $msg = $del1 Then $i = Del($inc) If $msg = $del Then GUICtrlDelete($a[$i]) $i = $i + $inc If $i < 0 Or $i > $MAXGr Then Exit EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Func Del($iInc) GUIDelete($child) CreateChild() If $iInc = -1 Then Return 5 Return 1 EndFunc ;==>Del Func CreateChild() $child = GUICreate("My Draw") $del = GUICtrlCreateButton("Delete", 50, 165, 50) $a[1] = GUICtrlCreateGraphic(20, 50, 100, 100) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 100, 100, 50, 80) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xc0c0ff) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 350, 200, 50, 80) GUICtrlCreateLabel("label", 65, 100, 30) GUICtrlSetColor(-1, 0xff) $a[2] = GUICtrlCreateGraphic(220, 10, 100, 100) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) $a[3] = GUICtrlCreateGraphic(220, 110, 100, 100) GUICtrlSetBkColor(-1, 0xf08080) GUICtrlSetColor(-1, 0xff) GUICtrlSetGraphic(-1, $GUI_GR_HINT, 1) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff00) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 50, 50, 80, 80) $a[4] = GUICtrlCreateGraphic(20, 200, 80, 80) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_HINT, 1) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 10, 10) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 30, 40) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff00) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 70, 70) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 50) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffff00) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 10) $a[5] = GUICtrlCreateGraphic(150, 10, 50, 50) GUICtrlSetBkColor(-1, 0xa0ffa0) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 20, 20) ; start point ; it is better to draw line and after point ; to avoid to switch color at each drawing GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0000ff) GUICtrlSetGraphic(-1, $GUI_GR_DOT, 30, 30) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 20, 40) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_DOT, 25, 25) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 40) GUICtrlSetGraphic(-1, $GUI_GR_DOT, 30, 40) $a[6] = GUICtrlCreateGraphic(110, 260, 230, 130) GUICtrlSetColor(-1, 0) ; to display a black border line GUICtrlSetBkColor(-1, 0xc0c0ff) GUICtrlSetGraphic(-1, $GUI_GR_HINT, 3) ; to display control lines and end points GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xff); fill in blue GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 120, 20) ; start point GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, 120, 100, 200, 20, 200, 100) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER + $GUI_GR_CLOSE, 100, 40, 40, 100, 40, 20) GUICtrlSetGraphic(-1, $GUI_GR_LINE, 60, 30) ; start point GUISetState() EndFunc ;==>CreateChild Function Reference GUICtrlSetImage thay đổi ảnh hay icon cho control. GUICtrlSetImage ( controlID, filename [, iconname [, icontype]] ) Parameters controlID control id filename tên file ảnh hoặc icon iconname icon index (mặc định = -1) icontype tùy chọn kích thước của icon 0 = nhỏ 1 = bình thường (mặc định) cho TreeViewItem icon size : 2 = được chọn 4 = item ko đc chọn. Return Value Success: Returns 1. Failure: Returns 0. Remarks Use a resource hacker to know the value of the valid icon name in a file. If used on a Button control the image will be displayed on the button. Images can also be set for Checkbox controls as long as the $BS_PUSHLIKE style is used. In both case the $BS_ICON or $BS_BITMAP styles are needed to select the type of the picture used. The first icon resolution will be used in a multi icon resolution file. I.E. if a 128x128 is the first resolution and the control is 64x64 the image will be truncated. !!! If use this command on a TreeViewItem the first time, then all other items will use this icon/image automatically by default !!! If you use GUICtrlSetImage on a TreeView or ListView then all items of it will change to this icon/image. Passing a positive number will reference the string equivalent icon name. Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers. Related GUICtrlCreatePic, GUICtrlCreateIcon, GUICtrlCreateButton, GUICtrlCreateCheckbox Example #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $msg GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example Function Reference GUICtrlSetLimit đặt giá trị to nhất, nhỏ nhất mà control có thể đạt tới. GUICtrlSetLimit ( controlID, max [, min] ) Parameters controlID control id max giá trị to nhất List controls là số item đc hiện thị. Input/Edit controls là số kí tự tối đa đc nhập vào. min giá trị nhỏ nhất Slider and UpDown controls có thể đạt tới. mặc định = 0 Return Value Success: Returns 1. Failure: Returns 0. Remarks None. Related GUICtrlCreateList, GUICtrlCreateInput, GUICtrlCreateEdit Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $msg GUICreate("My GUI limit input 3 chars") ; will create a dialog box that when displayed is centered GUICtrlCreateInput("", 10, 20) GUICtrlSetLimit(-1, 3) ; to limit the entry to 3 chars GUISetState() . GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 100, 100, 50, 80) GUICtrlSetGraphic(-1, $GUI_GR_COLOR,. GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) $a[3] = GUICtrlCreateGraphic(220, 110, 100, 100) GUICtrlSetBkColor(-1, 0xf08080) . $GUI_GR_LINE, 40, 40) GUICtrlSetGraphic(-1, $GUI_GR_DOT, 30, 40) $a[6] = GUICtrlCreateGraphic(110, 260, 230, 130) GUICtrlSetColor(-1, 0) ; to display a black border line GUICtrlSetBkColor(-1,

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

Xem thêm: AutoI Technology Curriculum Book part 60 ppsx