Win32 API 日本語リファレンス
ホームGraphics.Gdi › FillRgn

FillRgn

関数
指定したブラシで領域を塗りつぶす。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

BOOL FillRgn(
    HDC hdc,
    HRGN hrgn,
    HBRUSH hbr
);

パラメーター

名前方向
hdcHDCin
hrgnHRGNin
hbrHBRUSHin

戻り値の型: BOOL

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

BOOL FillRgn(
    HDC hdc,
    HRGN hrgn,
    HBRUSH hbr
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool FillRgn(
    IntPtr hdc,   // HDC
    IntPtr hrgn,   // HRGN
    IntPtr hbr   // HBRUSH
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function FillRgn(
    hdc As IntPtr,   ' HDC
    hrgn As IntPtr,   ' HRGN
    hbr As IntPtr   ' HBRUSH
) As Boolean
End Function
' hdc : HDC
' hrgn : HRGN
' hbr : HBRUSH
Declare PtrSafe Function FillRgn Lib "gdi32" ( _
    ByVal hdc As LongPtr, _
    ByVal hrgn As LongPtr, _
    ByVal hbr As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FillRgn = ctypes.windll.gdi32.FillRgn
FillRgn.restype = wintypes.BOOL
FillRgn.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    wintypes.HANDLE,  # hrgn : HRGN
    wintypes.HANDLE,  # hbr : HBRUSH
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
FillRgn = Fiddle::Function.new(
  lib['FillRgn'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # hrgn : HRGN
    Fiddle::TYPE_VOIDP,  # hbr : HBRUSH
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn FillRgn(
        hdc: *mut core::ffi::c_void,  // HDC
        hrgn: *mut core::ffi::c_void,  // HRGN
        hbr: *mut core::ffi::c_void  // HBRUSH
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool FillRgn(IntPtr hdc, IntPtr hrgn, IntPtr hbr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_FillRgn' -Namespace Win32 -PassThru
# $api::FillRgn(hdc, hrgn, hbr)
#uselib "GDI32.dll"
#func global FillRgn "FillRgn" sptr, sptr, sptr
; FillRgn hdc, hrgn, hbr   ; 戻り値は stat
; hdc : HDC -> "sptr"
; hrgn : HRGN -> "sptr"
; hbr : HBRUSH -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global FillRgn "FillRgn" sptr, sptr, sptr
; res = FillRgn(hdc, hrgn, hbr)
; hdc : HDC -> "sptr"
; hrgn : HRGN -> "sptr"
; hbr : HBRUSH -> "sptr"
; BOOL FillRgn(HDC hdc, HRGN hrgn, HBRUSH hbr)
#uselib "GDI32.dll"
#cfunc global FillRgn "FillRgn" intptr, intptr, intptr
; res = FillRgn(hdc, hrgn, hbr)
; hdc : HDC -> "intptr"
; hrgn : HRGN -> "intptr"
; hbr : HBRUSH -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procFillRgn = gdi32.NewProc("FillRgn")
)

// hdc (HDC), hrgn (HRGN), hbr (HBRUSH)
r1, _, err := procFillRgn.Call(
	uintptr(hdc),
	uintptr(hrgn),
	uintptr(hbr),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FillRgn(
  hdc: THandle;   // HDC
  hrgn: THandle;   // HRGN
  hbr: THandle   // HBRUSH
): BOOL; stdcall;
  external 'GDI32.dll' name 'FillRgn';
result := DllCall("GDI32\FillRgn"
    , "Ptr", hdc   ; HDC
    , "Ptr", hrgn   ; HRGN
    , "Ptr", hbr   ; HBRUSH
    , "Int")   ; return: BOOL
●FillRgn(hdc, hrgn, hbr) = DLL("GDI32.dll", "bool FillRgn(void*, void*, void*)")
# 呼び出し: FillRgn(hdc, hrgn, hbr)
# hdc : HDC -> "void*"
# hrgn : HRGN -> "void*"
# hbr : HBRUSH -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。