
Code AardioLine:24复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.import
win
.ui;var
winform = win
.form(text="改变按钮颜色示例"
;right=279
;bottom=239
;composited=1
)- winform.add(
- button={cls=
"button"
;text="点这里1"
;left=16
;top=104
;right=261
;bottom=159
;font=LOGFONT(h=-14
);z=1
}; - button2={cls=
"button"
;text="点这里2"
;left=16
;top=168
;right=261
;bottom=223
;font=LOGFONT(h=-14
);z=3
}; - edit={cls=
"edit"
;text="Edit"
;left=16
;top=16
;right=264
;bottom=96
;edge=1
;multiline=1
;z=2
} - )
import
raw
.apiHookraw
.apiHook(-
"user32.dll"
, -
"DrawTextExW"
, -
"int(ptr,ptr,int,ptr,int,ptr)"
, -
function
(hdc,lpchText,cchText,rect,format,lpdtp){ -
var
str = ..string
.fromUtf16(..raw
.str(lpchText,true
)); -
if
str="点这里1"
::Gdi32.SetTextColor(hdc,0x0000FF); -
elseif
str="点这里2"
::Gdi32.SetTextColor(hdc,0xFF0000); -
owner
.callApi(hdc,lpchText,cchText,rect,format,lpdtp); -
return
true
; - }
- ).install();
- winform.show();
win
.loopMessage();
Code AardioLine:28复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.import
win
.ui;var
winform = win
.form(text="改变按钮颜色示例"
;right=279
;bottom=239
;composited=1
)- winform.add(
- button={cls=
"button"
;text="点这里1"
;left=16
;top=104
;right=261
;bottom=159
;font=LOGFONT(h=-14
);z=1
}; - button2={cls=
"button"
;text="点这里2"
;left=16
;top=168
;right=261
;bottom=223
;font=LOGFONT(h=-14
);z=3
}; - edit={cls=
"edit"
;text="Edit"
;left=16
;top=16
;right=264
;bottom=96
;edge=1
;multiline=1
;z=2
} - )
import
raw
.apiHookraw
.apiHook(-
"user32.dll"
, -
"DrawTextExW"
, -
"int(ptr,ptr,int,ptr,int,ptr)"
, -
function
(hdc,lpchText,cchText,rect,format,lpdtp){ -
var
str = ..string
.fromUtf16(..raw
.str(lpchText,true
)); -
if
str="点这里1"
::Gdi32.SetTextColor(hdc,0x0000FF); -
elseif
str="点这里2"
::Gdi32.SetTextColor(hdc,0xFF0000); -
var
rc = ::RECT(); - ..
raw
.convert(rect,rc); - rc.right-=
100
; - gdi.fillRect(hdc,0x00FF00,rc);
-
owner
.callApi(hdc,lpchText,cchText,rect,format,lpdtp); -
return
true
; - }
- ).install();
- winform.show();
win
.loopMessage();