放大镜增加十字架做指针问题
想了2天都没搞定:face (36): 只好上来求高手帮忙了 :face (35):下面是我修改的的放大镜+读取坐标和颜色的代码
目前的的情况如(图1)
出现状况没看到鼠标指的地方
我想把
指针点的地方显示在(图2)十字架中心 (图2是用画图软件做成的)
请问 代码要怎么修改 请高手帮改一下如果可以的话 指出错误与修改原理 谢谢
Global $SRCCOPY = 0x00CC0020
Global $leave = 0
HotKeySet("","leave")
HotKeySet("`","shijian")
GUICreate("主窗口", 195 ,230)
$MyhWnd = WinGetHandle("主窗口")
GuiCtrlCreateLabel("相对X坐标:", 5, 215)
$X=GuiCtrlCreateInput("0000", 63, 215, 35, 20)
GuiCtrlCreateLabel("相对Y坐标:", 102, 215)
$Y=GuiCtrlCreateInput("0000", 165, 215, 35, 20)
GuiCtrlCreateLabel("16位颜色代码:", 5, 195)
$S=GuiCtrlCreateInput("000000", 90, 193, 80, 20)
WinSetOnTop("主窗口","",1)
GUISetState()
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-19
$t = $xy-19
DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC,"int",0,"int",0,"int",195,"int",190,"int",$DeskHDC,"int",$l,"int",$t,"int",19,"int",19,"long",$SRCCOPY)
EndIf
DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC,"hwnd",0)
EndIf
DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC,"hwnd",$MyhWnd)
Sleep(25)
AutoItSetOption ("PixelCoordMode",0);;设置用于象素函数的坐标参照,相对当前激活窗口的坐标位置
AutoItSetOption ("MouseCoordMode",0);;设置用于鼠标函数的坐标参照,可以是相对当前激活窗口的坐标位置
$array1=MouseGetPos();;
$var = PixelGetColor($array1,$array1);;
GUICtrlSetData($X,$array1)
GUICtrlSetData($Y,$array1);;
GUICtrlSetData($S,"0x"&Hex($var, 6));;
GUICtrlSetBkColor ($S,$var )
EndFunc
Func leave()
$leave = 1
EndFunc
Func shijian()
sleep(50)
IniWrite("C:\Documents and Settings\User\桌面\suzhi.ini","dizhi","x",$array0)
IniWrite("C:\Documents and Settings\User\桌面\suzhi.ini","dizhi","y",$array1)
IniWrite("C:\Documents and Settings\User\桌面\suzhi.ini","dizhi","16wys","0x"&Hex($var, 6))
MsgBox(0,0,"保存成功,请进行下步操作")
Exit
EndFunc
[ 本帖最后由 askask150 于 2008-12-15 00:30 编辑 ] 牛人,我都不会做呢,只会些简单的东西
Global $pos, $var
Opt("PixelCoordMode", 0) ;;设置用于象素函数的坐标参照,相对当前激活窗口的坐标位置
Opt("MouseCoordMode", 0);;设置用于鼠标函数的坐标参照,可以是相对当前激活窗口的坐标位置
HotKeySet("", "leave")
HotKeySet("`", "shijian")
$hwd = GUICreate("主窗口", 200, 240, 0, 0, BitXOR(0x80880000, 0x00800000), 0x00000080 + 0x00000008)
GUICtrlCreateLabel("坐标颜色代码:", 12, 203, 90, 15)
$S = GUICtrlCreateInput("", 102, 201, 80, 18)
GUICtrlCreateLabel("相对X坐标:", 3, 223, 66, 16)
$X = GUICtrlCreateInput("", 63, 220, 30, 18)
GUICtrlCreateLabel("相对Y坐标:", 98, 223, 66, 16)
$Y = GUICtrlCreateInput("", 160, 220, 35, 18)
GUISetState()
While 1
Sleep(25)
MAG()
WEnd
Func MAG()
$MyHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $hwd)
If @error Then Return
$DeskHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
If Not @error Then
$pos = MouseGetPos()
If Not @error Then
DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC, "int", 0, "int", 0, "int", 200, "int", 200, "int", $DeskHDC, "int", $pos - 25, "int", $pos - 25, "int", 50, "int", 50, "long", 0x00CC0020)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $DeskHDC, "hwnd", 0)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC, "hwnd", $hwd)
Sleep(25)
$var = PixelGetColor($pos, $pos);;
GUICtrlSetData($X, $pos)
GUICtrlSetData($Y, $pos);;
GUICtrlSetData($S, "0x" & Hex($var, 6));;
GUICtrlSetBkColor($S, $var)
EndFunc ;==>MAG
Func leave()
Exit
EndFunc ;==>leave
Func shijian()
FileWrite(@DesktopDir & '\MOUSEPOS.LOG', @CRLF & '记录生成时间:' & @YEAR & '年' & @MON & '月' & @MDAY &'日' & _
' ' & @HOUR & '时' & @MIN & '分' & @SEC & '秒' & @CRLF & '鼠标X坐标:' & $pos & @CRLF & _
'鼠标Y坐标:' & $pos & @CRLF & '颜色代码:' & "0x" & Hex($var, 6) & @CRLF)
If MsgBox(262212, '选择', "保存成功,是否继续?") = 6 Then Return
Exit
EndFunc ;==>shijian
如要移动显示窗口,点一下窗口然后--ALT+SPACE M 方向键 :face (1): 老大 你改的太牛了
$pos - 25, $pos - 25
这两个相对偏移是怎么算出来的呢????
$pos 这是用来做什么的 没见你调用啊??
图片十字架该怎么做?
我想把一张十字图片放进窗口弄透明
结果十字图片被“放大”的窗口|盖住了
并且把整个窗口透明了
有没有把控件放在窗口内的顶层的这个函数
把十字图片放在顶层应该可以了吧
或者把那显示图片放在下面
[ 本帖最后由 askask150 于 2008-12-13 04:16 编辑 ] 自己画一个十字线上去并置顶显示应该可以出十字线了,$pos是定义数组的大小的,是一个,是一个,已经用完了!-25是我估计那个位置是准的就编进去的! 原帖由 liongodmien 于 2008-12-13 21:27 发表 http://www.autoitx.com/images/common/back.gif
自己画一个十字线上去并置顶显示应该可以出十字线了,$pos是定义数组的大小的,是一个,是一个,已经用完了!-25是我估计那个位置是准的就编进去的!
置顶的函数是什么??
具体该怎么做?
查了帮助 好像没这个函数
[ 本帖最后由 askask150 于 2008-12-14 08:32 编辑 ] 拷回去看看,以后应该能用得着!:face (1): $csx=50
$csy=50
$l = $l - $csx/2
$t = $t - $csy/2
;前段:显示的位置,显示的大小区域;后段:截屏的位置,截屏的大小区域
;两个大小区域的比例就是放大比例
DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC, "int", 330, "int", 10, "int", 100, "int", 100, "int", $DeskHDC, "int", $l, "int", $t, "int", $csx, "int", $csy, "long", $SRCCOPY)
:face (20): 谢谢楼上的大哥解释 程序不错,收藏了 程序不错,收藏了
具体该怎么画一个十字线上去并置顶显示 ??? 如果在放大镜区域内能有鼠标指示位置就好了.....
页:
[1]