ホーム › Graphics.Gdi › CreateHatchBrush
CreateHatchBrush
関数指定したハッチパターンと色のブラシを作成する。
シグネチャ
// GDI32.dll
#include <windows.h>
HBRUSH CreateHatchBrush(
HATCH_BRUSH_STYLE iHatch,
COLORREF color
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| iHatch | HATCH_BRUSH_STYLE | in |
| color | COLORREF | in |
戻り値の型: HBRUSH
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
HBRUSH CreateHatchBrush(
HATCH_BRUSH_STYLE iHatch,
COLORREF color
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr CreateHatchBrush(
int iHatch, // HATCH_BRUSH_STYLE
uint color // COLORREF
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function CreateHatchBrush(
iHatch As Integer, ' HATCH_BRUSH_STYLE
color As UInteger ' COLORREF
) As IntPtr
End Function' iHatch : HATCH_BRUSH_STYLE
' color : COLORREF
Declare PtrSafe Function CreateHatchBrush Lib "gdi32" ( _
ByVal iHatch As Long, _
ByVal color As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateHatchBrush = ctypes.windll.gdi32.CreateHatchBrush
CreateHatchBrush.restype = ctypes.c_void_p
CreateHatchBrush.argtypes = [
ctypes.c_int, # iHatch : HATCH_BRUSH_STYLE
wintypes.DWORD, # color : COLORREF
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
CreateHatchBrush = Fiddle::Function.new(
lib['CreateHatchBrush'],
[
Fiddle::TYPE_INT, # iHatch : HATCH_BRUSH_STYLE
-Fiddle::TYPE_INT, # color : COLORREF
],
Fiddle::TYPE_VOIDP)#[link(name = "gdi32")]
extern "system" {
fn CreateHatchBrush(
iHatch: i32, // HATCH_BRUSH_STYLE
color: u32 // COLORREF
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr CreateHatchBrush(int iHatch, uint color);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CreateHatchBrush' -Namespace Win32 -PassThru
# $api::CreateHatchBrush(iHatch, color)#uselib "GDI32.dll"
#func global CreateHatchBrush "CreateHatchBrush" sptr, sptr
; CreateHatchBrush iHatch, color ; 戻り値は stat
; iHatch : HATCH_BRUSH_STYLE -> "sptr"
; color : COLORREF -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global CreateHatchBrush "CreateHatchBrush" int, int
; res = CreateHatchBrush(iHatch, color)
; iHatch : HATCH_BRUSH_STYLE -> "int"
; color : COLORREF -> "int"; HBRUSH CreateHatchBrush(HATCH_BRUSH_STYLE iHatch, COLORREF color)
#uselib "GDI32.dll"
#cfunc global CreateHatchBrush "CreateHatchBrush" int, int
; res = CreateHatchBrush(iHatch, color)
; iHatch : HATCH_BRUSH_STYLE -> "int"
; color : COLORREF -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procCreateHatchBrush = gdi32.NewProc("CreateHatchBrush")
)
// iHatch (HATCH_BRUSH_STYLE), color (COLORREF)
r1, _, err := procCreateHatchBrush.Call(
uintptr(iHatch),
uintptr(color),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HBRUSHfunction CreateHatchBrush(
iHatch: Integer; // HATCH_BRUSH_STYLE
color: DWORD // COLORREF
): THandle; stdcall;
external 'GDI32.dll' name 'CreateHatchBrush';result := DllCall("GDI32\CreateHatchBrush"
, "Int", iHatch ; HATCH_BRUSH_STYLE
, "UInt", color ; COLORREF
, "Ptr") ; return: HBRUSH●CreateHatchBrush(iHatch, color) = DLL("GDI32.dll", "void* CreateHatchBrush(int, dword)")
# 呼び出し: CreateHatchBrush(iHatch, color)
# iHatch : HATCH_BRUSH_STYLE -> "int"
# color : COLORREF -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。