//orphanPlus 静态悬浮控件 import win.ui.ctrl.plus; namespace win.ui; class orphanPlus{ ctor(form,param){ param = ..table.assign({ cls="plus"; autoResize = false; clipBk = false; notify = false; transparent = true; disabled = true; hide = 1; left = 0; top = 0; width = 0; height = 0; } ,param); this = form.add({param})[1]; if(this.autoResize) return this; this.wndproc = { [0x02E0/*_WM_DPICHANGED]*/] = function(hwnd, message, wParam, lParam){ if( !this.disableDpiScaling ){ var dpiX,dpiY = ::HIWORD(wParam),::LOWORD(wParam); var scaleX,scaleY = dpiX/96,dpiY/96; var origScaleX,origScaleY = owner[["dpiScaleX"]],owner[["dpiScaleY"]]; var x,y,cx,cy = owner.getPos(); cx2 = ( cx / origScaleX ) * scaleX; cy2 = ( cy / origScaleY ) * scaleY; x2 = x -(cx2 - cx)/2; y2 = y -(cy2 - cy)/2; var sx,sy,scrCx,scrCy = ..win.getWorkArea(this.hwnd).xywh(); if( x2+cx2 > scrCx && x+cx<=scrCx){x2 = scrCx-(scrCx-(x+cx))-cx2;} if( ( x == sx ) || ( x2 sx ) ){x2 = 0;} if( y2+cy2 > scrCy && y+cy<=scrCy){y2 = scrCy-(scrCy-(y+cy) )-cy2;} if( ( y == sy ) || ( y2 sy ) ){y2 = 0;} owner.setPos(x2,y2,cx2,cy2); this.enableDpiScaling(scaleX,scaleY) } } } this.orphanWindow(true); form.enableDpiScaling("init"); }; } /**intellisense() win.ui.orphanPlus = 静态悬浮 plus 控件 win.ui.orphanPlus( = 创建静态悬浮 plus 控件\n默认透明、禁用事件响应,\n不跟随父窗口调整位置或缩放大小 win.ui.orphanPlus(.(winform,param) = 参数 @winform 必须传入 win.form 对象指定父窗体,\nparam 传入 plus 控件创建参数 win.ui.orphanPlus() = !!ui_ctrl_plus. end intellisense**/