PLUS实现动态精灵动画
By
admin
at 2020-08-06 • 3人收藏 • 1833人看过
感谢: 撒旦微笑 分享源码
动态精灵动画
//精灵动画 import win.ui; /*DSG{{*/ var winform = win.form(text="鼠标放到图像上显示动画";right=724;bottom=224;bgcolor=16777215) winform.add( plus1={cls="plus";left=26;top=62;right=106;bottom=142;notify=1;z=1}; plus2={cls="plus";left=143;top=62;right=223;bottom=142;notify=1;z=2}; plus3={cls="plus";left=259;top=62;right=339;bottom=142;notify=1;z=3}; plus4={cls="plus";left=376;top=62;right=456;bottom=142;notify=1;z=4}; plus5={cls="plus";left=492;top=62;right=572;bottom=142;notify=1;z=5}; plus6={cls="plus";left=609;top=62;right=689;bottom=142;notify=1;z=6} ) /*}}*/ var imgList = { "https://img.t.sinajs.cn/t6/style/images/common/steps_att_sad.png"; "https://img.t.sinajs.cn/t6/style/images/common/steps_att_angry.png"; "https://img.t.sinajs.cn/t6/style/images/common/steps_att_surprised.png"; "https://img.t.sinajs.cn/t6/style/images/common/steps_att_happy.png"; "https://img.t.sinajs.cn/t6/style/images/common/steps_att_like.png"; } var createSpirit = function(plus,img,col,row=1,interval){ import inet.http; import gdip.bitmap; col = tonumber(col); row = tonumber(row); interval = tonumber(interval); var bitmap = gdip.bitmap(img); if(!bitmap or !col or !row){ return ; } if(!interval){ interval = 1000/(col*row); } var spirit = bitmap.split(col,row); plus.foreground = spirit[1]; plus.foreRepeat = "scale" plus.onAnimation = function(state){ state = state+1; if(state>col*row){ state = 1 } plus.foreground = spirit[state] return state; } plus.onStateChange = function(){ if( plus.state.hover ){ plus.startAnimation(interval,0) } else { plus.stopAnimation() plus.foreground = spirit[1]; } } } for(k,v in imgList){ createSpirit(winform["plus"++k],v,20) } var url = "https://img-ask.csdn.net/upload/202005/13/1589349016_808127.png" createSpirit(winform.plus6,url,6,4,50) winform.show() win.loopMessage();
3 个回复 | 最后更新于 2020-08-15
登录后方可回帖
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
custom={cls="custom";text="自定义控件";left=29;top=17;right=751;bottom=461;ah=1;aw=1;z=1}
)
/*}}*/
import com
import winex
import win.debounce
winex.waitDelay=500
var wps=com.CreateObject("KWPS.Application");
var book = wps.Documents.Add() //创建工作簿
var App_hwnd= winex.waitMainWnd("OpusApp","WPS Office")
//嵌入
win.setParent(App_hwnd,winform.custom.hwnd)
var x,y,w,h=win.getPos(winform.custom.hwnd)
win.setPos(App_hwnd,0,0,w,h)
win.modifyStyle(winform.custom.hwnd,,0x2000000/*_WS_CLIPCHILDREN*/)
//嵌入外部程序,一定要附加输入队列,不然输入有关的功能就会乱套了
var tid = win.getThreadProcessId(App_hwnd)
::User32.AttachThreadInput( ..thread.getId(),tid,true);
wps.Visible=true
winform.custom.adjust = function( cx,cy,wParam ) {
if !App_hwnd return;
win.debounce(win.setPos(App_hwnd,0,0,cx,cy))
winform.custom.redraw()
};
winform.show();
win.loopMessage();
/*
没有权限,只好发在这里
请问,在嵌入wps的时候,多了一个 透明的边框,这个怎么消除它?
*/