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