ホーム › Graphics.GdiPlus › GdipSetPenDashArray
GdipSetPenDashArray
関数ペンのカスタム破線パターンの配列を設定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipSetPenDashArray(
GpPen* pen,
const FLOAT* dash,
INT count
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pen | GpPen* | inout |
| dash | FLOAT* | in |
| count | INT | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipSetPenDashArray(
GpPen* pen,
const FLOAT* dash,
INT count
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetPenDashArray(
IntPtr pen, // GpPen* in/out
ref float dash, // FLOAT*
int count // INT
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetPenDashArray(
pen As IntPtr, ' GpPen* in/out
ByRef dash As Single, ' FLOAT*
count As Integer ' INT
) As Integer
End Function' pen : GpPen* in/out
' dash : FLOAT*
' count : INT
Declare PtrSafe Function GdipSetPenDashArray Lib "gdiplus" ( _
ByVal pen As LongPtr, _
ByRef dash As Single, _
ByVal count As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipSetPenDashArray = ctypes.windll.gdiplus.GdipSetPenDashArray
GdipSetPenDashArray.restype = ctypes.c_int
GdipSetPenDashArray.argtypes = [
ctypes.c_void_p, # pen : GpPen* in/out
ctypes.POINTER(ctypes.c_float), # dash : FLOAT*
ctypes.c_int, # count : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipSetPenDashArray = Fiddle::Function.new(
lib['GdipSetPenDashArray'],
[
Fiddle::TYPE_VOIDP, # pen : GpPen* in/out
Fiddle::TYPE_VOIDP, # dash : FLOAT*
Fiddle::TYPE_INT, # count : INT
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipSetPenDashArray(
pen: *mut GpPen, // GpPen* in/out
dash: *const f32, // FLOAT*
count: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetPenDashArray(IntPtr pen, ref float dash, int count);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetPenDashArray' -Namespace Win32 -PassThru
# $api::GdipSetPenDashArray(pen, dash, count)#uselib "gdiplus.dll"
#func global GdipSetPenDashArray "GdipSetPenDashArray" sptr, sptr, sptr
; GdipSetPenDashArray varptr(pen), varptr(dash), count ; 戻り値は stat
; pen : GpPen* in/out -> "sptr"
; dash : FLOAT* -> "sptr"
; count : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipSetPenDashArray "GdipSetPenDashArray" var, var, int ; res = GdipSetPenDashArray(pen, dash, count) ; pen : GpPen* in/out -> "var" ; dash : FLOAT* -> "var" ; count : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipSetPenDashArray "GdipSetPenDashArray" sptr, sptr, int ; res = GdipSetPenDashArray(varptr(pen), varptr(dash), count) ; pen : GpPen* in/out -> "sptr" ; dash : FLOAT* -> "sptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipSetPenDashArray(GpPen* pen, FLOAT* dash, INT count) #uselib "gdiplus.dll" #cfunc global GdipSetPenDashArray "GdipSetPenDashArray" var, var, int ; res = GdipSetPenDashArray(pen, dash, count) ; pen : GpPen* in/out -> "var" ; dash : FLOAT* -> "var" ; count : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipSetPenDashArray(GpPen* pen, FLOAT* dash, INT count) #uselib "gdiplus.dll" #cfunc global GdipSetPenDashArray "GdipSetPenDashArray" intptr, intptr, int ; res = GdipSetPenDashArray(varptr(pen), varptr(dash), count) ; pen : GpPen* in/out -> "intptr" ; dash : FLOAT* -> "intptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipSetPenDashArray = gdiplus.NewProc("GdipSetPenDashArray")
)
// pen (GpPen* in/out), dash (FLOAT*), count (INT)
r1, _, err := procGdipSetPenDashArray.Call(
uintptr(pen),
uintptr(dash),
uintptr(count),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipSetPenDashArray(
pen: Pointer; // GpPen* in/out
dash: Pointer; // FLOAT*
count: Integer // INT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipSetPenDashArray';result := DllCall("gdiplus\GdipSetPenDashArray"
, "Ptr", pen ; GpPen* in/out
, "Ptr", dash ; FLOAT*
, "Int", count ; INT
, "Int") ; return: Status●GdipSetPenDashArray(pen, dash, count) = DLL("gdiplus.dll", "int GdipSetPenDashArray(void*, void*, int)")
# 呼び出し: GdipSetPenDashArray(pen, dash, count)
# pen : GpPen* in/out -> "void*"
# dash : FLOAT* -> "void*"
# count : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。