函数参考


_WinAPI_GetBkMode

检索指定设备环境的当前背景混合模式

#Include <WinAPI.au3>
_WinAPI_GetBkMode($hDC)

参数

$hDC 设备环境句柄

返回值

成功: 返回当前背景混合模式值,无论是透明或不透明
失败: 返回 0

注意/说明

 设备环境的背景混合模式会影响文本,阴影画刷,非实线画笔样式.

相关

_WinAPI_SetBkMode, _WinAPI_DrawText, _WinAPI_CreatePen, _WinAPI_SelectObject

详情参考

在MSDN中搜索


示例/演示


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

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)

MsgBox(4096, "信息", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

; 注释下一行可以获得黑色背景而不是透明背景
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

MsgBox(4096, "信息", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

While 1
    _WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
    Sleep(100)
WEnd

Func _Exit()
    _WinAPI_SelectObject($hDC, $hOldFont)
    _WinAPI_DeleteObject($hFont)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_InvalidateRect(0, 0)
    $tRECT = 0
    Exit
EndFunc   ;==>_Exit