plus做界面的应用,顺便把上面动画窗体加进去看看效果
By
admin
at 2017-12-10 • 1人收藏 • 1806人看过
import win.ui; /*DSG{{*/ var winform = win.form(text="宽版界面演示";right=722;bottom=432;image=$"\res\images\bg.gif";bkBottom=2;bkLeft=83;bkRight=255;bkTop=110;border="none";parent=...) winform.add( btnClose={cls="plus";left=689;top=0;right=715;bottom=27;background="\res\images\close-default.png";dr=1;dt=1;notify=1;z=5}; btnMax={cls="plus";left=662;top=0;right=688;bottom=27;background="\res\images\max-default.png";dr=1;dt=1;z=6}; btnMin={cls="plus";left=635;top=0;right=661;bottom=27;background="\res\images\min-default.png";dr=1;dt=1;z=7}; btnNav1={cls="plus";text="测试按钮";left=18;top=7;right=94;bottom=88;background="\res\images\icon_bg.jpg";bgcolor=1949696;bkBottom=3;bkLeft=7;bkRight=8;bkTop=2;color=16777215;dl=1;dt=1;foreground="\res\images\excel.png";notify=1;paddingBottom=7;paddingLeft=5;paddingRight=5;paddingTop=5;valign="bottom";x=0.5;y=0.20000000298023;z=3}; btnNav2={cls="plus";text="测试按钮2";left=115;top=7;right=191;bottom=88;background="\res\images\icon_bg.jpg";bkBottom=3;bkLeft=7;bkRight=8;bkTop=2;color=16777215;dl=1;dt=1;foreground="\res\images\feed.png";notify=1;paddingBottom=7;paddingLeft=5;paddingRight=5;paddingTop=5;valign="bottom";x=0.5;y=0.20000000298023;z=2}; btnNav3={cls="plus";text="测试按钮3";left=212;top=7;right=288;bottom=88;background="\res\images\icon_bg.jpg";bkBottom=3;bkLeft=7;bkRight=8;bkTop=2;clip=1;color=16777215;dl=1;dt=1;foreground="\res\images\rss.png";notify=1;paddingBottom=7;paddingLeft=5;paddingRight=5;paddingTop=5;valign="bottom";x=0.5;y=0.20000000298023;z=1}; custom={cls="custom";left=5;top=96;right=717;bottom=431;bgcolor=16777215;db=1;dl=1;dr=1;dt=1;z=4} ) /*}}*/ import win.animate; //最大化按钮样式 winform.btnMax.skin( checked = { //还原按钮的样式 background = { hover = "/res/images/restore-hover.png"; active = "/res/images/restore-active.png"; default = "/res/images/restore-default.png"; } } //下面是最大化按钮的样式 background = { hover = "/res/images/max-hover.png"; active = "/res/images/max-active.png"; default = "/res/images/max-default.png"; } ) //最小化按钮样式 winform.btnMin.skin( background = { hover = "/res/images/min-hover.png"; active = "/res/images/min-active.png"; default = "/res/images/min-default.png"; } ) //关闭按钮样式 winform.btnClose.skin( background = { hover = "/res/images/close-hover.png"; active = "/res/images/close-active.png"; default = "/res/images/close-default.png"; } ) //最大化按钮 winform.btnMax.oncommand = function(id,event){ //点击最大化或还原按钮,并将当前窗体是否最大化设为控件的checked状态 winform.btnMax.checked = winform.hitmax(); } //最小化按钮 winform.btnMin.oncommand = function(id,event){ winform.hitmin() } //关闭按钮 winform.btnClose.oncommand = function(id,event){ winform.close() } //添加下面的代码以支持鼠标拖动窗体 winform.wndproc = { [ 0x201/*_WM_LBUTTONDOWN*/ ] = function(hwnd,message,wParam,lParam){ winform.hitCaption(); } [ 0x203/*_WM_LBUTTONDBLCLK*/] = function(hwnd,message,wParam,lParam){ winform.btnMax.checked = winform.hitmax();//双击标题栏最大化 } } namespace theme{ mainButton = { background = { hover = "/res/images/main-nav-bg-hover.png"; active = "/res/images/main-nav-bg-hover.png"; default = "/res/images/main-nav-bg.png"; } checked = { //指定选中状态的样式 background = { hover = "/res/images/main-nav-bg-hover.png"; active = "/res/images/main-nav-bg-hover.png"; default = "/res/images/main-nav-bg-hover.png"; } } group = "main";//这个参数指定按钮是单选按钮分组,使该分组中的按钮同时只能选中一个 } } winform.btnNav3.skin( theme.mainButton ) winform.btnNav2.skin( theme.mainButton ) winform.btnNav1.skin( theme.mainButton ) var frmPage1 = winform.custom.loadForm("\forms\page1.aau" ); var frmPage2 = winform.custom.loadForm("\forms\page2.aau" ); var frmPage3 = winform.custom.loadForm("\forms\page3.aau" ); winform.btnNav1.oncommand = function(id,event){ winform.custom.showChildren(false); //frmPage1.show(true); win.animate.slide(frmPage1.hwnd).show(500)//,0x2/*水平自右向左*/); } winform.btnNav2.oncommand = function(id,event){ winform.custom.showChildren(false); //frmPage2.show(true); win.animate.slide(frmPage2.hwnd).show(500)//,0x2/*水平自右向左*/); } winform.btnNav3.oncommand = function(id,event){ winform.custom.showChildren(false); //frmPage3.show(true); win.animate.slide(frmPage3.hwnd).show(500,0x2/*水平自右向左*/); } //添加阴影边框 import win.ui.shadow; win.ui.shadow( winform,70,3 ); //下面的代码为窗体添加可拖动改变大小的边框 import win.ui.resizeBorder; win.ui.resizeBorder( winform ); //限制最大化时不要覆盖任务栏 import win.ui.minmax; win.ui.minmax( winform ); winform.show() win.loopMessage();
这里关键是动画窗体的使用方法:
先把几个窗体都加载进去,显示的话显示最后一个加载的,然后再每次准备点击大图标的地方先取消所有子窗体的显示,然后在显示特定的,因为用动画窗体,所以直接用加载的frmpage的句柄。
winform.btnNav3.oncommand = function(id,event){ winform.custom.showChildren(false); //frmPage3.show(true); win.animate.slide(frmPage3.hwnd).show(500,0x2/*水平自右向左*/); }
2 个回复 | 最后更新于 2022-05-14
此帖已被锁定,禁止回复
res资源包哪里可以下载?