plus实现的滑动侧边栏
By
netfox
at 2022-03-18 • 0人收藏 • 992人看过
import fonts.fontAwesome; import win.ui; import win.timer; import win.ui.simpleWindow /*DSG{{*/ var winform = win.form(text="aardio form";right=1080;bottom=687;bgcolor=16760832;border="none";maximize=1) winform.add( panel={cls="custom";text="自定义控件";left=-2;top=-6;right=189;bottom=689;bgcolor=3947580;db=1;dt=1;z=1}; web={cls="custom";text="自定义控件";left=193;top=28;right=1082;bottom=687;db=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-35;weight=700);z=2} ) /*}}*/ winform.modifyStyle(,0x2000000/*_WS_CLIPCHILDREN*/) win.ui.simpleWindow(winform) var panelWidth,timer,open = winform.panel.width,win.timer( winform ); timer.setInterval(100); timer.onTimer = function(hwnd,msg,id,tick){ if open { winform.panel.width = winform.panel.width + 50; winform.web.left = winform.panel.width - 3 if (winform.panel.width >= panelWidth){ timer.disable() open = false; } }else { winform.panel.width = winform.panel.width - 50; winform.web.left =winform.panel.width - 3 if (winform.panel.width <= 59){ timer.disable() open = true; } } } winform.panel.add( Side={cls="plus";left=0;top=81;right=7;bottom=134;bgcolor=16777215;z=6}; qq={cls="plus";text="MUSIC";url="http://music.qq.com";left=0;top=134;right=189;bottom=187;bgcolor=3947580;color=16777215;font=LOGFONT(h=-16;weight=700);notify=1;z=4}; baidu={cls="plus";text="BAIDU";left=0;top=81;url="http://www.baidu.com";right=189;bottom=134;bgcolor=3947580;color=16777215;font=LOGFONT(h=-16;weight=700);notify=1;z=3}; control={cls="plus";text=" ";left=156;top=10;right=192;bottom=40;dr=1;dt=1;iconColor=16777215;iconStyle={font=LOGFONT(h=-16;name='FontAwesome';weight=700)};iconText='\uF039';notify=1;z=3} ["163"]={cls="plus";text="163";url="http://www.163.com";left=0;top=187;right=189;bottom=240;bgcolor=3947580;color=16777215;font=LOGFONT(h=-16;weight=700);notify=1;z=5} ) winform.web.add( info={cls="plus";text="Welcome to aarido";left=150;top=28;right=1082;bottom=687;db=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-35;weight=700)}; ) moveSide = function(btnControl){ winform.panel.Side.top = btnControl.top; winform.panel.Side.height = btnControl.height; } for(hwnd,ctrl in winform.panel.eachControlEx("plus") ){ ctrl.oncommand = function(id,event){ moveSide(ctrl) winform.web.info.text = ctrl.url; } } winform.panel.control.oncommand = function(id,event){ timer.enable(); } winform.adjust = function( cx,cy,wParam ) { winform.web.left = winform.panel.width - 3 winform.panel.redrawBackground() winform.web.redrawBackground() }; winform.show(); win.loopMessage();
细节没处理好,有兴趣的完善下。
4 个回复 | 最后更新于 2022-03-12
登录后方可回帖
不够顺畅丝滑, 一顿一顿卡卡的, 优化任重道远, 哈