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

AutoI Technology Curriculum Book part 59 docx

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 (114.06 KB, 6 trang )


GUICtrlSetDefColor(0xFF0000) ; will change text color for all defined controls

GUICtrlCreateLabel("label", 10,5)

GUICtrlCreateRadio("radio", 10,25,50)
GUICtrlSetColor(-1, 0x0000FF) ; will change text color for specified control

GUICtrlCreateButton("button", 10,55)

GUISetState() ; will display an empty dialog box

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

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example



Function Reference
GUICtrlSetFont
đặt font cho control.
GUICtrlSetFont (controlID, size [, weight [, attribute [, fontname]]] )
Parameters
controlID control ID
size kích thước chữ (mặc định là 8.5)
weight chiều rộng (đậm hay nhạt ở đây) (mặc định = 400 = bình thường).
attribute


in nghiêng :2
gạch chân :4
strike :8
các kiểu có thể + lại với nhau vd 6 = 2 + 4 cả in nghiêng và gạch chân.

fontname tên font

Return Value
Success:

Returns 1.
Failure:

Returns 0.

Remarks
size có thể là số ko nguyên vd 8.5


Related
GUICtrlCreate , GUISetFont
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()

Local $font, $msg

GUICreate("My GUI") ; will create a dialog box that when displayed is
centered

$font = "Comic Sans MS"
GUICtrlCreateLabel("underlined label", 10, 20)
GUICtrlSetFont(-1, 9, 400, 4, $font) ; will display underlined characters

GUICtrlCreateLabel("italic label", 10, 40)
GUICtrlSetFont(-1, 9, 400, 2, $font) ; will display italic characters

GUISetFont(9, 400, 8, $font) ; will display strike characters
GUICtrlCreateLabel("strike label", 10, 60)

GUISetState() ; will display an empty dialog box

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

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example



Function Reference
GUICtrlSetGraphic
cập nhật dữ liệu trên control.

GUICtrlSetGraphic ( controlID, type [, par1 [, par6]] )
Parameters
controlID control id
type vẽ kiểu gì: dot, line, bezier, rect, ellipse, pie.
par1 par6

các tham số.

Return Value
Success:

Returns 1.
Failure:

Returns 0.
Returns -1 nếu dữ liệu ko hợp lệ

Remarks
tọa độ (x,y) được tính từ tọa độ góc trên trái của control, tọa độ có thể đi ra ngoài
control nhưng vẫn phải nằm trong GUI

Graphic Type table
kiểu

tham số

giải nghĩa

$GUI_GR_COLOR
Color

[,BkColor]
đặt mầu vẽ color và mầu nền bkcolor,
mầu nền có thể
= $GUI_GR_NOBKCOLOR là mầu
trong suốt
$GUI_GR_MOVE x,y di chuyển con trỏ vẽ tới tọa độ x, y
$GUI_GR_DOT x,y vẽ 1 chấm tại tọa độ x, y
$GUI_GR_PIXEL x,y vẽ 1 điểm ảnh tại tọa độ x, y
$GUI_GR_LINE x,y
vẽ một đuwongf thẳng từ tọa độ con
trỏ vẽ tới tọa độ x, y
sau khi vẽ tọa độ con trỏ vẽ sẽ di
chuyển tới tọa độ x, y
$GUI_GR_BEZIER x,y,x1,y1,x2,y2

Draw a bezier curve with 2 control
points.
$GUI_GR_RECT x,y,w,h vẽ đường chữ nhật
$GUI_GR_ELLIPSE x,y,w,h vẽ đường elíp
$GUI_GR_PIE x,y,r,sa,wa
vẽ hình tròn tâm (x,y) bán kính r, góc
đầu sa góc cuối wa
$GUI_GR_CLOSE
to close the current drawing. It has to
be added to $GUI_GR_LINE or
$GUI_GR_BEZIER to close current
drawing. Use alone will be ignored.
$GUI_GR_REFRESH làm tươi
$GUI_GR_HINT
to display control point and end point

of bezier/line curve.
$GUI_GR_PENSIZE n đặt kích thước bút vẽ = n pixel
$GUI_GR_NOBKCOLOR

mầu trong suốt

Related
GUICtrlCreateGraphic
Example

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Global $MAXGr = 6, $del, $child
Global $a[$MAXGr + 1] ; 0 and $MAXGr entries not used to allow
GUICtrlDelete result

Example()

Func Example()
Local $msg, $inc, $i, $del1

GUICreate("My Main", -1, -1, 100, 100)
$del1 = GUICtrlCreateButton("Delete", 50, 200, 50)
GUISetState()
CreateChild()

$i = 1

$inc = 1
;$i=5 ; uncomment to delete starting from last define Graphic control
;$inc=-1

Do
$msg = GUIGetMsg()

×