本帖最后由 happytc 于 2011-8-25 23:50 编辑
就是按住左键不放,移动鼠标,那个椭圆也跟着光标动
不行了,通宵了,下面的代码,我怎么也想不到实现那种效果了
#Include <ScreenCapture.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global Const $CursorID = MouseGetCursor()
Global $hGUI, $hpen, $hGraphicBg
WhiteBoard()
Func WhiteBoard()
Local $HBITMAP, $hBmp, $PenSize, $ColorValue
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
$HBITMAP = _ScreenCapture_Capture("", 0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0)
$hGUI = GUICreate("WhiteBoard-LiveCapture", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState(@SW_SHOW, $hGUI)
$hGraphicBg = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP)
_GDIPlus_GraphicsDrawImage($hGraphicBg, $hBmp, 0, 0)
_WinAPI_DeleteObject($HBITMAP)
$PenSize = 8
$hPen = _GDIPlus_PenCreate(0xA0FFFF00, $PenSize)
GUISetOnEvent(-3, "_Exit")
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
While True
Sleep(2000)
WEnd
EndFunc
Func Draw()
Local $MousePos, $MouseXOri, $MouseYOri
GUISetCursor(0, 1, $hGUI)
$MousePos = GUIGetCursorInfo($hGUI)
$MouseXOri = $MousePos[0]
$MouseYOri = $MousePos[1]
Sleep(50)
Do
$MousePos = GUIGetCursorInfo($hGUI)
If $MouseXOri <> $MousePos[0] Or $MouseYOri <> $MousePos[1] Then
;_GDIPlus_GraphicsDrawLine($hGraphicBg, $MousePos[0], $MousePos[1], $MouseXOri, $MouseYOri, $hPen)
_GDIPlus_GraphicsDrawEllipse($hGraphicBg, $MousePos[0], $MousePos[1],$MouseXOri, $MouseYOri, $hPen)
;$MouseXOri = $MousePos[0]
;$MouseYOri = $MousePos[1]
EndIf
Until Not $MousePos[2]
EndFunc
Func _Exit()
GUISetCursor($CursorID, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphicBg)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc
|