|
如题:
就是咱们论坛【开发工具箱】那个板块里面的那个。
这个大概是去年刚学aar的时候写的,一直也没更新过了,之前还发布到各大软件平台了。
现在源码奉上。希望对新人有点帮助吧
工程下载:
链接:https://pan.baidu.com/s/1B0cWiEnLxYPDvrGpe59g6A 密码:tqis
主要代码如下:
main.aardio文件里:
- import win.ui;
- import gdip.fontAwesome;
- /*DSG{{*/
- mainForm = win.form(text="aardio form";right=692;bottom=400;bgcolor=8421376;border="none";clipch=1)
- mainForm.add(
- logo={cls="plus";text='\uF2A9';left=627;top=0;right=673;bottom=44;color=33023;dr=1;dt=1;font=LOGFONT(name='FontAwesome';h=-35;weight=700);transparent=1;z=9};
- logo2={cls="plus";text="GIF录制助手";left=603;top=40;right=693;bottom=63;color=33023;dr=1;dt=1;font=LOGFONT(name='微软雅黑';h=-14;weight=700);transparent=1;z=8};
- picturebox={cls="picturebox";left=2;top=2;right=601;bottom=399;bgcolor=0;db=1;dl=1;dr=1;dt=1;z=1};
- 停止={cls="plus";text='\uF04D 停止';left=601;top=245;right=693;bottom=288;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);transparent=1;z=5};
- 关于={cls="plus";text='\uF05A 关于';left=601;top=371;right=693;bottom=401;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);notify=1;transparent=1;z=10};
- 关闭={cls="plus";text='\uF011 关闭';left=601;top=329;right=693;bottom=372;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);notify=1;transparent=1;z=11};
- 开启={cls="plus";text='\uF1C8 开启';left=601;top=120;right=693;bottom=163;bgcolor=20608;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);transparent=1;z=2};
- 新建={cls="plus";text='\uF0C7 新建';left=601;top=78;right=693;bottom=121;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);transparent=1;z=6};
- 暂停={cls="plus";text='\uF04C 暂停';left=601;top=162;right=693;bottom=205;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);transparent=1;z=3};
- 查看={cls="plus";text='\uF07C';left=646;top=287;right=693;bottom=330;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);notify=1;transparent=1;z=7};
- 继续={cls="plus";text='\uF04B 继续';left=601;top=204;right=693;bottom=246;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-16);transparent=1;z=4};
- 预览={cls="plus";text='\uF06E';left=601;top=287;right=648;bottom=330;bgcolor=3768320;border={color=-16777216;width=1};color=16777215;db=1;dr=1;font=LOGFONT(name='FontAwesome';h=-19);notify=1;transparent=1;z=12}
- )
- /*}}*/
- /*皮肤代码{{*/
- namespace theme{
- list = {
- color = {
- hover = 0xFFFF8080; //鼠标放上去时悬停的状况
- active = 0xFFFF8080; //鼠标点击时
- disable = 0xFF008080;
- }
- }
- }
- mainForm.新建.skin( theme.list );
- mainForm.停止.skin( theme.list );
- mainForm.关于.skin( theme.list );
- mainForm.查看.skin( theme.list );
- mainForm.关闭.skin( theme.list );
- mainForm.开启.skin( theme.list );
- mainForm.暂停.skin( theme.list );
- mainForm.预览.skin( theme.list );
- /*
- mainForm.水印.skin( theme.list );
- */
- mainForm.继续.skin( theme.list );
- mainForm.查看.disabled = true;
- mainForm.停止.disabled = true;
- mainForm.开启.disabled = true;
- mainForm.暂停.disabled = true;
- mainForm.继续.disabled = true;
- mainForm.预览.disabled = true;
- /*}}*/
- var gifThr , gifPath;
- mainForm.关于.oncommand = function(id,event){
- import process;
- process.execute("http://www.htmlayout.cn/t/16");//打开网页
- }
- import fsys.dlg;
- mainForm.新建.oncommand = function(id,event){
- gifPath = fsys.dlg.save("*.gif|*.gif",,,mainForm.hwnd,,"gifTest.gif");//获取路径
- if(gifPath){
- var ret = string.save(gifPath,"");//保存
- if(ret){
- thread.set("PicLantch",gifPath )
- //mainForm.msgbox("保存成功!")
- mainForm.停止.disabled = true;
- mainForm.开启.disabled = false;
- mainForm.暂停.disabled = true;
- mainForm.继续.disabled = true;
-
- }else {
- mainForm.msgbox("新建失败!")
- }
- }
- }
- mainForm.开启.oncommand = function(id,event){
- thread.set("startOrend",true);
-
- gifThr = thread.create(
- function( mainForm,caphwnd,gifPath ){
- import soImage;
- import win.ui ;
- import com;
- var img = soImage();
- var gifFile = soImage.gifFile(gifPath);
- while(thread.get("startOrend")){
- var x,y,cx,cy = mainForm.picturebox.getPos();//坐标 x , y 宽 高
- var xx,yy = win.toScreen(mainForm.hwnd,x,y);
- var pic = com.picture.snap(caphwnd,xx,yy,cx,cy);
- img.fromBitmap(pic.Handle);
- gifFile.write(img,false,,,3); //写入GIF文件
- sleep(50);//50HZ
- }
- gifFile.close();//释放录制
- // console.log("录制完毕")
- },mainForm,win.getDesktop(),gifPath
- )
- owner.disabled = true;
- mainForm.停止.disabled = false;
- mainForm.暂停.disabled = false;
- mainForm.继续.disabled = true;
- }
- mainForm.暂停.oncommand = function(id,event){
- thread.suspend( gifThr );
- owner.disabled = true;
- mainForm.停止.disabled = false;
- mainForm.继续.disabled = false;
- }
- mainForm.继续.oncommand = function(id,event){
- thread.resume( gifThr );
- owner.disabled = true;
- mainForm.停止.disabled = false;
- mainForm.暂停.disabled = false;
- }
- mainForm.停止.oncommand = function(id,event){
- thread.set("startOrend",false);
- thread.wait(gifThr,50);
- raw.closehandle(gifThr);
- owner.disabled = true;
- mainForm.开启.disabled = false;
- mainForm.暂停.disabled = true;
- mainForm.继续.disabled = true;
- mainForm.查看.disabled = false;
- mainForm.预览.disabled = false;
- }
- mainForm.查看.oncommand = function(id,event){
- import process;
- if(gifPath){
- mulupath = io.splitpath(gifPath);
- process.explore(mulupath.dir);
- }
- }
- mainForm.预览.oncommand = function(id,event){
- if(gifPath){
- mainForm.loadForm("\res\chakan.aardio");
- }
- }
- mainForm.关闭.oncommand = function(id,event){
- if(gifThr){
- thread.set("startOrend",false);
- thread.wait(gifThr,50);
- raw.closehandle(gifThr);
- }
- mainForm.close();
- }
- mainForm.wndproc = function(hwnd,message,wParam,lParam){
- select( message ) {
- case 0x201/*_WM_LBUTTONDOWN*/{
- mainForm.hitCaption();
- }
- }
- }
- mainForm.transparent(0x808000,0)
- win.setTopmost(mainForm.hwnd);
- import win.ui.shadow;
- win.ui.shadow(mainForm,,5);
- //下面的代码为窗体添加可拖动改变大小的边框
- import win.ui.resizeBorder;
- win.ui.resizeBorder( mainForm );
- import win.ui.minmax;
- win.ui.minmax(mainForm,120,380)
- mainForm.enableDpiScaling();
- mainForm.show();
- return win.loopMessage();
复制代码
引用的chakan.aardio文件里:
这个文件里的代码引用了论坛里
仿Picasa照片查看器效果 http://bbs.aardio.com/forum.php? ... mp;highlight=%B7%C2
神码 和 多多洛 提供的代码
- import win.ui;
- /*DSG{{*/
- var winform = win.form(text="GIF录制助手预览器";right=0;bottom=0;exmode="toolwindow")
- winform.add()
- /*}}*/
- winform.transparent(true);//启用分层窗口以支持透明
- winform.fullscreen(true);//全屏
-
- import web.layout;//导入内置浏览器引擎
- import web.layout.behavior.windowCommand;//导入标题栏按钮支持库
- wbLayout = web.layout(winform); //创建浏览器
-
- wbLayout.html = /**
- <!DOCTYPE html>
- <html>
- <body>
- <div id="hl_ctrl_bar"><span id="close" command="window-close" title="关闭">r</span></div>
- <img id="simulate_area"></img>
- </body>
- </html>
- **/
-
- wbLayout.css = /**
- html { background: none; } /* HTML背景透明 */
- body, html { margin:0; padding:0; height:100%; width:100% }
- body { margin:0; outline: none; background-color:rgba(0,0,0,0.7); }
-
- /* 窗体控制按钮 */
- #hl_ctrl_bar { max-width: max-intrinsic; padding-right: 5px; position: absolute; right:0; top:0; padding: 0; }
- #hl_ctrl_bar span {
- display: block; float: left; color: #fff; line-height: 22px; padding: 0 5px;
- font-family: Webdings; font-weight: bold; font-size: 13px;
- behavior: windowCommand; /* 添加标题栏按钮交互行为 */
- }
- #hl_ctrl_bar #close {
- width: 40px; height: 40px; padding:0; overflow: hidden;line-height: 28px;
- text-indent: 16px; font-size: 14px;background-color:#666; border-radius:0 0 0 100%;
- }
- /*提示框样式,解决右上角提示乱码问题*/
- popup {
- font-family: '微软雅黑','宋体';
- font-size: 12px;
- font-weight: normal;
- padding: 0 5px;
- }
- #hl_ctrl_bar span#close:hover { background-color: #da3610; }
-
- #simulate_area[ready]{
- background:#000;/* 设背景色后发光效果性能会好点 */
- outline:15px glow #000 0px;
- width:0; height:0;
-
- }
-
- /* 图像已下载完成 */
- #simulate_area[src]:not(:incomplete){
-
- top: 50%%; left: 50%%; right: 50%%; bottom: 50%%;
- position: absolute;
-
- /*初始化事件*/
- assigned!:
- self.start-animation( 0.9s ); /*启动动画*/
-
- /*动画事件*/
- animation-step!:
- self::width = morph("cubic-in-out", 1px, self.min-intrinsic-width()),
- self::height = morph("cubic-in-out", 1px, self.min-intrinsic-height() );
-
- animation-end!:
- self.ready = "true"; /* 动画完了再显示发光效果 */
- }
- **/
-
- winform.updateImage = function(url){
- var ltEle = wbLayout.queryEle('#simulate_area'); //CSS选择器获取节点对象
- ltEle.src = url;//动态修改图像
- }
-
- //预览指定图像
- winform.updateImage( thread.get("PicLantch") );
-
- winform.show();
- win.loopMessage();
复制代码
|
|