本帖最后由 gapkiller 于 2010-1-22 14:34 编辑
由于调用了GuiCtrlSetGraphic($id, $GUI_GR_REFRESH),所以会闪
想要达到下面的效果,不知道还有没有别的方法....#include <GuiConstantsEX.au3>
#Include <Misc.au3>
GUICreate("",@DesktopWidth,@DesktopHeight,0,0,0x80000000)
GUISetBkColor(0x00FFFF)
$btn_quit = GUICtrlCreateButton(" &Quit ",@DesktopWidth/2-100,@DesktopHeight*3/4)
$btn_clear = GUICtrlCreateButton("&Clear",@DesktopWidth/2+50,@DesktopHeight*3/4)
GUICtrlCreateGraphic(0,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0xFF0000)
GUICtrlSetGraphic(-1,$GUI_GR_PENSIZE,4)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case -7 ;-- left btn down
$pos = MouseGetPos()
GUICtrlSetGraphic(-1,$GUI_GR_MOVE,$pos[0],$pos[1])
While 1
$pos = MouseGetPos()
GUICtrlSetGraphic(-1,$GUI_GR_LINE,$pos[0],$pos[1])
$msg = GUIGetMsg()
Switch $msg
Case -11 ; mouse move
GUICtrlSetGraphic(-1,$GUI_GR_REFRESH)
Case $btn_quit
Exit
Case $btn_clear
GUICtrlDelete(-1)
GUICtrlCreateGraphic(0,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0xFF0000)
GUICtrlSetGraphic(-1,$GUI_GR_PENSIZE,4)
ExitLoop
Case -8 ; left btn up
ExitLoop
EndSwitch
WEnd
Case -9 ; right btn down
$APIColor = _ChooseColor(2,0,2)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$APIColor)
Case $btn_quit
Exit
Case $btn_clear
GUICtrlDelete(-1)
GUICtrlCreateGraphic(0,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0xFF0000)
GUICtrlSetGraphic(-1,$GUI_GR_PENSIZE,4)
EndSwitch
WEnd
|