通过对窗口获得和失去激活(active)状态来改变窗口颜色
By
admin
at 2021-11-01 • 0人收藏 • 1265人看过
顺便说下, 这个gif使用jacenHe老大写的那个[图形图像]->[GIF录制]的范例录制
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=777;bottom=434) winform.add( bk={cls="bk";left=39;top=36;right=754;bottom=124;bgcolor=8421376;z=1}; button={cls="button";text="Button";left=51;top=317;right=312;bottom=395;z=2}; button2={cls="button";text="Button";left=359;top=317;right=570;bottom=371;z=3}; edit={cls="edit";text="当窗口被激活的时候, 上面的颜色会变红, 窗口失去激活状态变蓝";left=52;top=192;right=759;bottom=280;edge=1;multiline=1;z=4} ) /*}}*/ var activeFlag = false; winform.show(); win.loopMessage( function(){ if(win.getForeground()==winform.hwnd){ if(!activeFlag){ winform.bk.bgcolor = 0x5566cc; winform.bk.redraw(); activeFlag = true; } }else { if(activeFlag){ winform.bk.bgcolor = 8421376; winform.bk.redraw(); activeFlag = false; } } } );
3 个回复 | 最后更新于 2021-11-02
登录后方可回帖
其实使用 winform.onActivate 就行