GDI画了线之后隐藏不能显示的问题
代码如下,按回车键隐藏、显示窗口,但是隐藏再显示之后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
把画线那部分做成子函数,调用就完了 回复 3# netegg
试过,不行~~ 虽然隐藏和显示解决了,但是你拖动一下窗口,线还是会出问题的~
如果能解决,求码...... 把场景踢掉 要有重绘机制 回复 6# sd23
能提供一下代码吗?
页:
[1]