aardio 官方社区

 找回密码
 注册会员

QQ登录

只需一步,快速开始

搜索
查看: 16174|回复: 8

自己练习做的放大镜

[复制链接]

4

主题

3

回帖

48

积分

新手入门

积分
48
发表于 2010-11-29 19:22:07 | 显示全部楼层 |阅读模式

//简易放大镜

import win.ui;
/*DSG{{*/
var winform = win.form( text="简易放大镜";bgcolor=65280;bottom=302;max=false;right=266;border="dialog frame";parent=...)
winform.add(
picturebox={ dr=1;dl=1;bottom=248;right=259;left=8;dt=1;top=8;border=1;transparent=1;db=1;cp=1;z=2;cls=
"picturebox" };
chkTopMost={ bgcolor=65280;bottom=281;color=0;right=216;left=112;top=264;z=3;text=
"保持窗口在前";cls="checkbox" };
button1={ bgcolor=16777215;bottom=284;color=0;text=
"启动放大镜";left=8;top=261;z=1;right=100;transparent=1;cls="button" }
)
/*}}*/

//置顶窗口
winform.chkTopMost.oncommand = function(id,event){
    win.setTopmost(winform.hwnd,winform.chkTopMost.checked)   
}

winform.button1.oncommand =
function(id,event){

    winform.setInterval( 5
/*毫秒*/, //定时执行代码
        function(hwnd,msg){
        
               
var x,y = win.getMessagePos();//得到当前鼠标坐标
                var x1=x-20;
               
var x2=x+20;
               
var y1=y-20;
               
var y2=y+20;
               
               
var _,_,nWidth,nHeight = winform.picturebox.getPos()
                nSrcWidth=(x2-x1)
                nSrcHeight=(y2-y1)
               
               
var hdc = ::GetDC(winform.picturebox.hwnd)
               
var srchdc = ::GetDC(0)
                ::StretchBlt(hdc,0,0,nWidth,nHeight,srchdc,x1,y1,nSrcWidth,nSrcHeight,0xCC0020
/*_SRCCOPY*/)
        
                ::ReleaseDC(winform.picturebox.hwnd,hdc)
                ::ReleaseDC(0,srchdc)
        }
    );   
}

winform.show(
true)
win.loopMessage();  

点评

真棒  发表于 2010-11-30 19:49

65

主题

880

回帖

5033

积分

荣誉会员

积分
5033
发表于 2010-11-29 21:28:57 | 显示全部楼层
这个一定要支持啊.........

0

主题

8

回帖

43

积分

新手入门

积分
43
发表于 2010-11-29 19:57:12 | 显示全部楼层
这个不错。支持下

13

主题

54

回帖

537

积分

三级会员

积分
537
发表于 2011-2-28 20:27:23 | 显示全部楼层
这个不错。支持下

2

主题

42

回帖

349

积分

二级会员

积分
349
发表于 2011-6-7 16:54:35 | 显示全部楼层
不错,学习下

1

主题

5

回帖

90

积分

一级会员

积分
90
发表于 2012-2-25 13:36:41 | 显示全部楼层
很不错 。。。如果能将鼠标也截进去就更好了。

48

主题

542

回帖

3328

积分

五级会员

积分
3328
发表于 2012-8-14 10:52:33 | 显示全部楼层
好玩 很有意思

6

主题

36

回帖

237

积分

二级会员

积分
237
发表于 2012-9-24 18:48:23 | 显示全部楼层
学习。

0

主题

9

回帖

109

积分

一级会员

积分
109
发表于 2012-9-26 09:08:56 | 显示全部楼层
就需要这样的精神,自己多动手,才能提高。
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

手机版|未经许可严禁引用或转载本站文章|aardio.com|aardio 官方社区 ( 皖ICP备09012014号 )

GMT+8, 2025-3-22 04:45 , Processed in 0.061141 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表