找回密码
 加入
搜索
查看: 7286|回复: 3

[GUI管理] 屏幕放大镜相关问题

  [复制链接]
发表于 2010-12-9 19:51:11 | 显示全部楼层 |阅读模式
悬赏200金钱已解决
本帖最后由 tryhi 于 2010-12-9 20:50 编辑

lanfengc 前辈的屏幕放大镜-_ScreenCapture_Capture的应用的原理是截取鼠标周围的屏幕为图片之后进行放大之后,发现放大之后非常模糊,无法看清像素点,我重新修改了一下,原理是获取鼠标周围的屏幕颜色然后进行重组,这样是可以看清像素点,但获取一个20x20范围就要400次,效率低到完全不能,不知有没有那种方法可以放大到看清像素点效率又高的。
#include <GUIConstants.au3>
Dim $pic[21][21]
$Form1 = GUICreate("放大镜-按'P'抓获", 203, 258, @DesktopWidth - 253, @DesktopHeight - 344)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState(@SW_SHOW)
For $i = 1 To 20
        For $j = 1 To 20
                $pic[$i][$j] = GUICtrlCreateGraphic( ($i - 1) * 10, ($j - 1) * 10, 10, 10)
        Next
Next
Opt("GUIOnEventMode", 1)
While 1
        $MousePos=MouseGetPos()
        For $i = 0 To 19
                For $j = 0 To 19
                        $color = PixelGetColor(($MousePos[0]-10)+$i,($MousePos[1]-10)+$j)
                        GUICtrlSetBkColor($pic[$i+1][$j+1],$color)
                Next
        Next
WEnd
Func Close()
        Exit
EndFunc   ;==>Close
---------------------------------------------------------------------------------
已解决,解决方法如下
Global $SRCCOPY = 0x00CC0020
Global $leave = 0
HotKeySet("{esc}","exit_x")
SplashTextOn ( "AU3MAG", "" , 100 , 100 , 0, 0, 1 )
$MyhWnd = WinGetHandle("AU3MAG")
While Not $leave
  Sleep(25)
   MAG()
WEnd
Func MAG()
  $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd)
  If @error Then Return
  $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0)
  If Not @error Then
     $xy = MouseGetPos()
     If Not @error Then
        $l = $xy[0]-10
        $t = $xy[1]-10
        DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int",0,"int",0,"int",100,"int",100,"int",$DeskHDC[0],"int",  $l,"int",$t,"int",20,"int",20,"long",$SRCCOPY)
     EndIf
     DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0)
  EndIf
  DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd)
EndFunc
Func Exit_x()
        Exit
EndFunc

最佳答案

查看完整内容

StretchBlt 函数

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-12-9 19:51:12 | 显示全部楼层
StretchBlt 函数

评分

参与人数 1金钱 +60 贡献 +10 收起 理由
tryhi + 60 + 10 已经找到了

查看全部评分

 楼主| 发表于 2010-12-9 20:59:06 | 显示全部楼层
找到了,在gdi32.dll里面
发表于 2013-5-22 20:00:35 | 显示全部楼层
挺好,改完的代码很清爽
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-22 22:50 , Processed in 0.074685 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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