代码拉取完成,页面将自动刷新
//液晶计时器
import fonts.fontAwesome;
import win.ui;
import win.ui.atom;
/*DSG{{*/
var mainForm = win.form(text="液晶计时器";left=-330;top=0;right=0;bottom=165;bgcolor=16777215;border="none";max=false)
mainForm.add(
btnChange={cls="plus";text='\uF021';left=5;top=79;right=37;bottom=110;border={radius=6};color=2368548;font=LOGFONT(h=-19;name='FontAwesome');notify=1;z=8};
btnClock={cls="plus";text="启动时钟";left=13;top=123;right=95;bottom=155;bgcolor=13234329;border={radius=6};notify=1;z=2};
btnClose={cls="plus";text='\uF00D';left=293;top=125;right=325;bottom=156;border={radius=6};color=2368548;font=LOGFONT(h=-19;name='FontAwesome');notify=1;z=10};
btnCountDownTimer={cls="plus";text="启动倒计时";left=194;top=77;right=289;bottom=109;bgcolor=13234329;border={radius=6};notify=1;z=3};
btnMin={cls="plus";text='\uF068';left=293;top=77;right=325;bottom=108;border={radius=6};color=2368548;font=LOGFONT(h=-19;name='FontAwesome');notify=1;z=11};
btnPause={cls="plus";text='\uF04C';left=202;top=125;right=234;bottom=156;border={radius=6};color=2368548;font=LOGFONT(name='FontAwesome';charset=0);notify=1;z=6};
btnStop={cls="plus";text='\uF04D';left=248;top=125;right=280;bottom=156;border={radius=6};color=2368548;font=LOGFONT(name='FontAwesome';charset=0);notify=1;z=7};
btnTimer={cls="plus";text="启动计时器";left=105;top=123;right=187;bottom=155;bgcolor=13234329;border={radius=6};notify=1;z=4};
datetimepick={cls="datetimepick";left=43;top=81;right=180;bottom=107;edge=1;hide=1;transparent=1;updown=1;z=5};
edtSec={cls="edit";left=43;top=81;right=180;bottom=107;align="center";edge=1;font=LOGFONT(h=-16;name='Times New Roman');num=1;z=9};
plusClock={cls="plus";left=56;top=0;right=276;bottom=64;notify=1;z=1}
)
/*}}*/
var atom,hwnd/*冲突窗口的句柄,该函数会自动激活此窗口*/ = mainForm.atom("B2EBB5EB-E620-42C0-B709-E572670A1ACE");
if(!atom){
/*为窗口设置原子值可以避免一个程序重复运行多个实例*/
win.quitMessage(); return;
}
var style = {
icon = {
background={
active=0xFF0078B0;
hover=0xFF00AEFF;
default=0;
};
};
button = {
background={
active=0xFF0078B0;
hover=0xFF00AEFF;
disabled=0xFFCCCCCC;
};
}
}
mainForm.btnChange.skin(style.icon)
mainForm.btnStop.skin(style.icon)
mainForm.btnPause.skin(style.icon)
mainForm.btnMin.skin(style.icon)
mainForm.btnClose.skin(style.icon)
mainForm.btnCountDownTimer.skin(style.button)
mainForm.btnClock.skin(style.button)
mainForm.btnTimer.skin(style.button)
import win.ui.lcdClock;
var lcdClock = win.ui.lcdClock(mainForm.plusClock);
if(!lcdClock.setImageAttributes) error("请先更新 win.ui.lcdClock 扩展库",2)
lcdClock.startClock();
var x,y = win.getScreen();
mainForm.onOk = function(){
if( !mainForm.plusClock.floating && #(mainForm.edtSec.text)>0 ){
mainForm.btnCountDownTimer.oncommand();
mainForm.hitMin();
}
}
mainForm.btnMin.oncommand = function(id,event){
mainForm.hitMin();
}
mainForm.btnClose.oncommand = function(id,event){
mainForm.close();
}
mainForm.onMinimize = function(lParam){
mainForm.plusClock.orphanWindow(true)
win.setTopmost(mainForm.plusClock.hwnd)
win.setPos(mainForm.hwnd,x-660,0)
mainForm.modifyStyleEx(0x40000/*_WS_EX_APPWINDOW*/,0x80/*_WS_EX_TOOLWINDOW*/);
mainForm.transparent(0)
mainForm.plusClock.floating = true;
return true;
}
mainForm.plusClock.onMouseDown = function(wParam,lParam){
if( mainForm.plusClock.floating ) {
::User32.SendMessage(owner.hwnd,0xA1/*_WM_NCLBUTTONDOWN*/,2/*_HTCAPTION*/,0);
}
else {
mainForm.hitCaption();
}
}
mainForm.plusClock.onMouseDoubuleClick = function(wParam,lParam){
if( !mainForm.plusClock.floating ) {
mainForm.hitMin();
return;
}
mainForm.plusClock.floating = false;
mainForm.transparent(false);
win.setTopmost(mainForm.plusClock.hwnd,false)
mainForm.modifyStyleEx(0x80/*_WS_EX_TOOLWINDOW*/,0x40000/*_WS_EX_APPWINDOW*/);
mainForm.resize();
mainForm.datetimepick.redraw()
}
mainForm.btnClock.oncommand = function(id,event){
lcdClock.startClock();
mainForm.btnClock.disabled = true;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = false
}
mainForm.btnCountDownTimer.oncommand = function(id,event){
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = true;
mainForm.btnTimer.disabled = false;
lcdClock.startCountDownTimer(,function(){
mainForm.btnCountDownTimer.disabled = false;
win.setPos(mainForm.hwnd,(x-330)/2,(y-165)/2);
mainForm.plusClock.onMouseDoubuleClick()
})
}
mainForm.btnTimer.oncommand = function(id,event){
lcdClock.startTimer();
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = true;
}
mainForm.btnPause.oncommand = function(id,event){
lcdClock.pause();
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = false;
}
mainForm.datetimepick.setFormat("' 设置倒计时:'HH':'mm':'ss");
mainForm.datetimepick.time = time.iso8601(0);
mainForm.datetimepick.onnotify = function(id,code,ptr){
if(code == 0xFFFFFD09/*_DTN_DATETIMECHANGE*/){
lcdClock.resetCountDownTimer( mainForm.datetimepick.time )
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = false
}
}
mainForm.edtSec.onChange = function(){
if(owner.onModified)owner.onModified(true);
lcdClock.resetCountDownTimer( tonumber(mainForm.edtSec.text)*1000 );
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = false
}
mainForm.btnStop.oncommand = function(id,event){
lcdClock.stop();
mainForm.btnClock.disabled = false;
mainForm.btnCountDownTimer.disabled = false;
mainForm.btnTimer.disabled = false;
}
mainForm.btnChange.oncommand = function( id,event ){
var dtpState = mainForm.datetimepick.hide;
if(dtpState) {
mainForm.datetimepick.hide = false;
mainForm.edtSec.hide = true;
} else {
mainForm.datetimepick.hide = true;
mainForm.edtSec.hide = false;
}
}
import win.ui.tooltip;
var tooltipCtrl = win.ui.tooltip( mainForm );//在窗口上创建tooltip控件
tooltipCtrl.addTool(mainForm.btnChange,"切换按时间或秒数来进行倒计时" )
tooltipCtrl.addTool(mainForm.btnStop,"停止计时" )
tooltipCtrl.addTool(mainForm.btnPause,"暂停计时" )
tooltipCtrl.addTool(mainForm.btnClose,"关闭窗口" )
tooltipCtrl.addTool(mainForm.btnClock,"显示时钟,不会清零计时器" )
tooltipCtrl.addTool(mainForm.btnMin,"点这里隐藏窗口并悬浮显示计时器" )
tooltipCtrl.addTool(mainForm.plusClock,"鼠标左键按住可以拖动,双击可以切换显示模式" )
mainForm.show()
win.loopMessage();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。