函数参考


_WinAPI_DeleteObject

删除逻辑笔,画笔,字体,位图,区域或调色板

#Include <WinAPI.au3>
_WinAPI_DeleteObject($hObject)

参数

$hObject 标识逻辑笔,画笔,字体,位图,区域或调色板

返回值

成功: 返回 True
失败: 返回 False

注意/说明

 不要删除选中到设备环境的图形对象.
 当一个图案画笔被删除,与画笔相关的位图不会被删除.位图必须单独删除.

相关

_GDIPlus_BitmapCloneArea, _GDIPlus_BitmapCreateFromFile, _GDIPlus_BitmapCreateFromGraphics, _GDIPlus_BitmapCreateFromHBITMAP, _GDIPlus_BitmapCreateHBITMAPFromBitmap, _GDIPlus_BitmapLockBits, _GDIPlus_BitmapUnlockBits, _ScreenCapture_Capture, _ScreenCapture_CaptureWnd, _WinAPI_CreateCompatibleBitmap, _WinAPI_CreatePen, _WinAPI_CreateRectRgn, _WinAPI_CreateRoundRectRgn

详情参考

在MSDN中搜索


示例/演示


#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
    Local $hDC, $hPen, $obj_orig

    $hDC = _WinAPI_GetWindowDC(0) ; 全部屏幕的场景(桌面)
    $hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
    $obj_orig = _WinAPI_SelectObject($hDC, $hPen)

    _WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; 水平左
    _WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; 水平右
    _WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; 垂直上
    ;_WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; 垂直下
    _WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
    _WinAPI_LineTo($hDC, $start_x, $start_y + 5)

    Sleep($time) ; 穿过屏幕几秒

    ; 刷新桌面(清扫穿过)
    _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

    ; 清除资源
    _WinAPI_SelectObject($hDC, $obj_orig)
    _WinAPI_DeleteObject($hPen)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc   ;==>ShowCross