ホーム › Graphics.Gdi › DrawEdge
DrawEdge
関数矩形の縁を3D効果の罫線で描画する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL DrawEdge(
HDC hdc,
RECT* qrc,
DRAWEDGE_FLAGS edge,
DRAW_EDGE_FLAGS grfFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| qrc | RECT* | inout |
| edge | DRAWEDGE_FLAGS | in |
| grfFlags | DRAW_EDGE_FLAGS | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL DrawEdge(
HDC hdc,
RECT* qrc,
DRAWEDGE_FLAGS edge,
DRAW_EDGE_FLAGS grfFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool DrawEdge(
IntPtr hdc, // HDC
IntPtr qrc, // RECT* in/out
uint edge, // DRAWEDGE_FLAGS
uint grfFlags // DRAW_EDGE_FLAGS
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DrawEdge(
hdc As IntPtr, ' HDC
qrc As IntPtr, ' RECT* in/out
edge As UInteger, ' DRAWEDGE_FLAGS
grfFlags As UInteger ' DRAW_EDGE_FLAGS
) As Boolean
End Function' hdc : HDC
' qrc : RECT* in/out
' edge : DRAWEDGE_FLAGS
' grfFlags : DRAW_EDGE_FLAGS
Declare PtrSafe Function DrawEdge Lib "user32" ( _
ByVal hdc As LongPtr, _
ByVal qrc As LongPtr, _
ByVal edge As Long, _
ByVal grfFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DrawEdge = ctypes.windll.user32.DrawEdge
DrawEdge.restype = wintypes.BOOL
DrawEdge.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_void_p, # qrc : RECT* in/out
wintypes.DWORD, # edge : DRAWEDGE_FLAGS
wintypes.DWORD, # grfFlags : DRAW_EDGE_FLAGS
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DrawEdge = Fiddle::Function.new(
lib['DrawEdge'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # qrc : RECT* in/out
-Fiddle::TYPE_INT, # edge : DRAWEDGE_FLAGS
-Fiddle::TYPE_INT, # grfFlags : DRAW_EDGE_FLAGS
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn DrawEdge(
hdc: *mut core::ffi::c_void, // HDC
qrc: *mut RECT, // RECT* in/out
edge: u32, // DRAWEDGE_FLAGS
grfFlags: u32 // DRAW_EDGE_FLAGS
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool DrawEdge(IntPtr hdc, IntPtr qrc, uint edge, uint grfFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DrawEdge' -Namespace Win32 -PassThru
# $api::DrawEdge(hdc, qrc, edge, grfFlags)#uselib "USER32.dll"
#func global DrawEdge "DrawEdge" sptr, sptr, sptr, sptr
; DrawEdge hdc, varptr(qrc), edge, grfFlags ; 戻り値は stat
; hdc : HDC -> "sptr"
; qrc : RECT* in/out -> "sptr"
; edge : DRAWEDGE_FLAGS -> "sptr"
; grfFlags : DRAW_EDGE_FLAGS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global DrawEdge "DrawEdge" sptr, var, int, int ; res = DrawEdge(hdc, qrc, edge, grfFlags) ; hdc : HDC -> "sptr" ; qrc : RECT* in/out -> "var" ; edge : DRAWEDGE_FLAGS -> "int" ; grfFlags : DRAW_EDGE_FLAGS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global DrawEdge "DrawEdge" sptr, sptr, int, int ; res = DrawEdge(hdc, varptr(qrc), edge, grfFlags) ; hdc : HDC -> "sptr" ; qrc : RECT* in/out -> "sptr" ; edge : DRAWEDGE_FLAGS -> "int" ; grfFlags : DRAW_EDGE_FLAGS -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL DrawEdge(HDC hdc, RECT* qrc, DRAWEDGE_FLAGS edge, DRAW_EDGE_FLAGS grfFlags) #uselib "USER32.dll" #cfunc global DrawEdge "DrawEdge" intptr, var, int, int ; res = DrawEdge(hdc, qrc, edge, grfFlags) ; hdc : HDC -> "intptr" ; qrc : RECT* in/out -> "var" ; edge : DRAWEDGE_FLAGS -> "int" ; grfFlags : DRAW_EDGE_FLAGS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL DrawEdge(HDC hdc, RECT* qrc, DRAWEDGE_FLAGS edge, DRAW_EDGE_FLAGS grfFlags) #uselib "USER32.dll" #cfunc global DrawEdge "DrawEdge" intptr, intptr, int, int ; res = DrawEdge(hdc, varptr(qrc), edge, grfFlags) ; hdc : HDC -> "intptr" ; qrc : RECT* in/out -> "intptr" ; edge : DRAWEDGE_FLAGS -> "int" ; grfFlags : DRAW_EDGE_FLAGS -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDrawEdge = user32.NewProc("DrawEdge")
)
// hdc (HDC), qrc (RECT* in/out), edge (DRAWEDGE_FLAGS), grfFlags (DRAW_EDGE_FLAGS)
r1, _, err := procDrawEdge.Call(
uintptr(hdc),
uintptr(qrc),
uintptr(edge),
uintptr(grfFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DrawEdge(
hdc: THandle; // HDC
qrc: Pointer; // RECT* in/out
edge: DWORD; // DRAWEDGE_FLAGS
grfFlags: DWORD // DRAW_EDGE_FLAGS
): BOOL; stdcall;
external 'USER32.dll' name 'DrawEdge';result := DllCall("USER32\DrawEdge"
, "Ptr", hdc ; HDC
, "Ptr", qrc ; RECT* in/out
, "UInt", edge ; DRAWEDGE_FLAGS
, "UInt", grfFlags ; DRAW_EDGE_FLAGS
, "Int") ; return: BOOL●DrawEdge(hdc, qrc, edge, grfFlags) = DLL("USER32.dll", "bool DrawEdge(void*, void*, dword, dword)")
# 呼び出し: DrawEdge(hdc, qrc, edge, grfFlags)
# hdc : HDC -> "void*"
# qrc : RECT* in/out -> "void*"
# edge : DRAWEDGE_FLAGS -> "dword"
# grfFlags : DRAW_EDGE_FLAGS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。