AutoHotkey GUI分享

 1 1、模板文本
 2 
 3 #SingleInstance, Force
 4 
 5 Gui, Add, Text, x10 y10, this is Text
 6 Gui, Show, w300 h200, Gui
 7 return
 8 
 9 2、字体
10 
11 #SingleInstance, Force
12 
13 ;设置字体颜色,字体大小、字体
14 Gui, Font, cRed s14, 微软雅黑
15 Gui, Add,Text, x10 y10, hello world
16 Gui, Add, Text, x10, this is seconds text
17 Gui, Font, cRed s20, 微软雅黑
18 Gui, Add, Text,cGreen x10, this is three text
19 Gui, Show, w300 h200, Gui
20 Return
21 
22 
23 
24 3、按钮
25 
26 #SingleInstance, Force
27 ;鼠标位置基于当前窗口
28 CoordMode, Mouse, window
29 
30 Gui, Add, Button,x10 y10 w100 h30 gEvent_click,  点击
31 Gui, Show, w300 h200, Gui
32 return
33 
34 Event_click:
35     MouseMove, 300, 300, 10
36     MsgBox, 事件触发了
37     return
38 
39 GuiClose:
40     MsgBox, 窗口关闭事件
41     ExitApp
42     return    
43 
44 
45 4、始终最上面
46 
47 #SingleInstance, Force
48 
49 Gui, +AlwaysOnTop
50 ;窗体背景色
51 Gui, Color, Black
52 Gui, Add, Text, cWhite x10 y10, this is text
53 Gui, Show, w300 h200
54 return
55 
56 
57 5、透明窗口
58 
59 #SingleInstance, Force
60 
61 
62 Gui, Color, #ffffff
63 Gui, +AlwaysOnTop
64 Gui, Show, w300 h200, Gui
65 Gui, +LastFound
66 WinSet, TransColor, #ffffff
67 return
68 
69 6、编辑框
70 
71 #SingleInstance, Force
72 
73 Gui, Color, , Aqua
74 ;5行 只读 只能输入数字(只读的时候不显示背景色)
75 Gui, Add, Edit, x10 y10 w200 r5 ReadOnly number, hello world
76 Gui, Show, w300 h200, demo
77 return
78 
79 
80 编辑框存储值
81 
82 #SingleInstance, Force
83 
84 Gui, Color, , Aqua
85 Gui, Add, Edit, x10 y10 w200 r5 vMyEdit gSubmit_all,  
86 Gui, Show, w300 h200, demo
87 return
88 
89 GuiClose:
90     ExitApp
91 
92 ;输入的同时显示输入的值
93 Submit_all:
94     ;保存每个控件的内容到其关联变量中(如果有)并且在没有使用NoHide选项时隐藏窗口
95     Gui,Submit, NoHide
96     ToolTip, %MyEdit%
97     return

猜你喜欢

转载自www.cnblogs.com/ronle/p/10675006.html