代码如下,按回车键隐藏、显示窗口,但是隐藏再显示之后GDI画的线便没有了,求解决~~#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
$Form1 = GUICreate("Form1", 801, 601, 192, 124)
$Pic1 = GUICtrlCreatePic("",-1,-1,1,1)
GUISetState(@SW_SHOW)
$hWnd = GUICtrlGetHandle($Pic1)
$hDC = _WinAPI_GetDC($hWnd)
$hPen_PS_SOLID = _WinAPI_CreatePen($PS_SOLID, 3, 0x000000);红色实线画笔宽度为10
$hBrush = _WinAPI_GetStockObject($NULL_BRUSH);空画刷
$oldPen = _WinAPI_SelectObject($hDC, $hPen_PS_SOLID)
$oldBrush = _WinAPI_SelectObject($hDC, $hBrush)
$tRECT = _WinAPI_CreateRect(31, 26, 769, 572)
_WinAPI_Rectangle($hDC, $tRECT)
_WinAPI_SelectObject($hDC, $oldPen)
_WinAPI_SelectObject($hDC, $oldBrush)
;删除 建立的对象
_WinAPI_DeleteObject($hPen_PS_SOLID)
_WinAPI_DeleteObject($hBrush)
$SS = 1
While 1
HotKeySet('{ENTER}','SHOW')
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func SHOW()
If $SS = 1 Then
GUISetState(@SW_HIDE, $Form1)
$ss = 0
Else
GUISetState(@SW_SHOW, $Form1)
$ss = 1
EndIf
EndFunc
|