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