//progress 进度条 import win.ui.ctrl.metaProperty;//导入控件属性元表支持 namespace win.ui.ctrl; class progress{ ctor(parent,tParam){ if(tParam){ tParam.cls = "msctls_progress32"; if(tParam.edge) tParam.style |= 0x20000/*_WS_EX_STATICEDGE*/; } this._private = { step = 10; } } @_metaProperty; } progress._metaProperty = metaProperty( bgcolor = { _get = function(){ return ::SendMessage(owner.hwnd,0x40E/*_PBM_GETBKCOLOR*/); } _set = function(v){ ::SendMessageInt(owner.hwnd,0x2001/*_PBM_SETBKCOLOR*/,0,v); } }; color = { _get = function(){ return ::SendMessage(owner.hwnd,0x40F/*_PBM_GETBARCOLOR*/); } _set = function(v){ ::SendMessageInt(owner.hwnd,0x409/*_PBM_SETBARCOLOR*/,0,v); } }; setRange = function(min,max){ if( max===null ) max = min; if( min===null ) min = max; if( max > 0xFFFF ){ error("最大值不能大于0xFFFF",2); } owner.step = 1; owner.pos = min; ::SendMessageInt(owner.hwnd, 0x401/*_PBM_SETRANGE*/, 0,::MAKELONG(min,max) ); }; min = { _get = function(){ return ::SendMessageInt(owner.hwnd, 0x407/*_PBM_GETRANGE*/, 1,0); } _set = function( v ){ owner.setRange( v,owner.max); } }; max = { _get = function(){ return ::SendMessageInt(owner.hwnd, 0x407/*_PBM_GETRANGE*/, 0,0 ); } _set = function( v ){ if( v > 0xFFFF ) error("最大值不能大于0xFFFF",2); owner.setRange( owner.min,v); } }; pos = { _get = function(){ return ::SendMessage(owner.hwnd,0x408/*_PBM_GETPOS*/); } _set = function( v ){ ::SendMessageInt(owner.hwnd, 0x402/*_PBM_SETPOS*/, v, 0) } }; delta = function(v){ ::SendMessageInt(owner.hwnd, 0x403/*_PBM_DELTAPOS*/, v, 0) }; stepIt = function(){ return ::SendMessage(owner.hwnd,0x405/*_PBM_STEPIT*/); }; step = { _get = function(){ return owner._private.step; } _set = function( v ){ owner._private.step = v; ::SendMessageInt(owner.hwnd, 0x404/*_PBM_SETSTEP*/,v,0) } }; startProgress = function(interval){ if(owner.animationId) owner.clearInterval(owner.animationId) owner.hide = false; var this = owner; var max = this.max; owner.animationId = owner.setInterval(function(){ if( this.pos >= max ) { ..thread.delay(600); this.pos = this.min; } else{ this.stepIt() } },interval:10) }; stopProgress = function(){ if(owner.animationId) owner.clearInterval(owner.animationId); owner.animationId = null; owner.hide = true; }; ) with progress._metaProperty{ value = pos; } /***intellisense() win.ui.ctrl.progress = 进度条控件 win.ui.ctrl.progress() = 进度条控件\n!progress. ?win.ui.ctrl.progress =!progress. !progress.delta(.(偏移值) = 修改当前进度,参数指定相对于当前进度的偏移值 !progress.stepIt() = 进度条前进一个增量,最出最大值时设为最小值。\n返回步进前位置 !progress.step = 设置stepIt()函数的步进增量\n默认为10 !progress.pos = 进度条当前值,不能大于 0xFFFF,不要使用负数 !progress.value = 进度条当前值,不能大于 0xFFFF,不要使用负数 !progress.setRange(.(最小值,最大值) = 设置进度条最大值,最小值\n注意值不能大于0xFFFF,不要使用负数 !progress.hwnd = 控件句柄 !progress.id = 控件ID !progress._parentForm = 返回创建控件的容器窗口(win.form对象),所有窗口控件都拥有此只读属性。\n对于使用窗体设计器创建的窗口,也就是返回设计时窗体容器。\n\n即使子窗口移除子窗口样式、更改父子关系,或以 orphanWindow显示,\n控件的 _parentForm 始终都不会改变\n!winform. !progress.getParent() = 返回父窗口\n!static. !progress.setParent(__/*控件对象*/) = 改变父窗口 !progress.hide = 当前控件窗口是否隐藏。\n仅检查当前窗口的可见性样式(窗口 是否移除了 _WS_VISIBLE 样式)。\n不考虑父窗口是否可见,不考虑是否被其他窗口遮挡。\n如果需要同时判断父窗口的可见性,应改用 win.isVisible 函数。\n\n以 `.` 前导的 `.hide()` 作为成员函数被调用时,\n作用等价于将 hide 属性设为 null 。 !progress.disabled = 是否禁用 !progress.left = 左侧坐标 !progress.right = 右侧坐标 !progress.top = 顶部坐标 !progress.bottom = 底部坐标 !progress.width = 宽度 !progress.height = 高度 !progress.redraw() = 刷新 !progress.show(true__) = 显示控件 !progress.getRect() = 控件区块位置(::RECT结构体) !progress.getRect(true) = 控件屏幕区块位置(::RECT结构体) !progress.setRect(rc) = 设置控件区块位置(::RECT结构体) !progress.setRect(rc,true) = 设置控件屏幕区块位置(::RECT结构体) !progress.getClientRect() = 控件客户区块位置(::RECT结构体)\n!rect. !progress.theme = 外观主题,例如\nwinform.button.theme = "Explorer"\nwinform.button.theme = false !progress.max = 最大值,注意不能大于0xFFFF,不要使用负数 !progress.min = 最小值,注意不能大于0xFFFF,不要使用负数 !progress.modifyStyle(.(remove,add,swpFlags) = 修改窗口样式,所有参数都是可选参数,\n@remove 用数值指定要移除的样式,可使用 _WS_ 前缀的常量\n@add 用数值指定要添加的样式,可使用 _WS_ 前缀的常量\n@swpFlags 可选用数值指定调整窗口选项,可使用 _SWP_ 前缀的常量\n如果指定了 @swpFlag ,则使用该参数调用::SetWindowPos\n细节请参考 win.modifyStyle 函数源码 !progress.modifyStyleEx(.(remove,add,swpFlags) = 修改窗口扩展样式,所有参数都是可选参数,\n@remove 用数值指定要移除的样式,可使用 _WS_EX_ 前缀的常量\n@add 用数值指定要添加的样式,可使用 _WS_EX_ 前缀的常量\n@swpFlags 可选用数值指定调整窗口选项,可使用 _SWP_ 前缀的常量\n如果指定了 @swpFlag ,则使用该参数调用::SetWindowPos\n细节请参考 win.modifyStyle 函数源码 !progress.capture = 是否捕获全局鼠标消息 !progress.close() = 关闭控件窗 !progress.invalidate(__/*可选使用::RECT()对象指定客户区*/) = 使窗口绘图区无效 !progress.invalidate(__/*可选使用::RECT()对象指定客户区*/,0) = 使窗口绘图区无效\n不刷新背景 !progress.update() = 重绘invalidate函数指定的区块 !progress.setFocus() = 设置焦点 !progress.setPos(.(x坐标,y坐标,宽,高,插入位置,参数) = 调整窗口位置或排序,所有参数可选\n同时指定x,y坐标则移动位置\n同时指定宽高则改变大小\n指定插入位置(句柄或_HWND前缀常量)则调整Z序 !progress.getPos() = 返回相对坐标,宽,高\nx,y,cx,cy=win.getPos(hwnd) !progress.orphanWindow() = 使控件脱离原来的窗口,可以显示在父窗口外面,\n但仍然显示在原来的位置,继续如影随形的跟随父窗口移动或改变大小,\n控件原来的固定边距等参数仍然有效 !progress.threadCallable() = 开启此控件的跨线程调用功能 !progress.startProgress() = 显示进条,并显示循环滚动进度的动画,\n可选在参数中指定动画间隔时,以毫秒为单位 !progress.stopProgress() = 停止显示循环滚动进度动画,隐藏进度条 end intellisense***/