Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipSetPenMode

GdipSetPenMode

関数
ペンの線の描画位置を示す配置モードを設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

// gdiplus.dll
#include <windows.h>

Status GdipSetPenMode(
    GpPen* pen,
    PenAlignment penMode
);

パラメーター

名前方向
penGpPen*inout
penModePenAlignmentin

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll
#include <windows.h>

Status GdipSetPenMode(
    GpPen* pen,
    PenAlignment penMode
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetPenMode(
    IntPtr pen,   // GpPen* in/out
    int penMode   // PenAlignment
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetPenMode(
    pen As IntPtr,   ' GpPen* in/out
    penMode As Integer   ' PenAlignment
) As Integer
End Function
' pen : GpPen* in/out
' penMode : PenAlignment
Declare PtrSafe Function GdipSetPenMode Lib "gdiplus" ( _
    ByVal pen As LongPtr, _
    ByVal penMode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipSetPenMode = ctypes.windll.gdiplus.GdipSetPenMode
GdipSetPenMode.restype = ctypes.c_int
GdipSetPenMode.argtypes = [
    ctypes.c_void_p,  # pen : GpPen* in/out
    ctypes.c_int,  # penMode : PenAlignment
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipSetPenMode = Fiddle::Function.new(
  lib['GdipSetPenMode'],
  [
    Fiddle::TYPE_VOIDP,  # pen : GpPen* in/out
    Fiddle::TYPE_INT,  # penMode : PenAlignment
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipSetPenMode(
        pen: *mut GpPen,  // GpPen* in/out
        penMode: i32  // PenAlignment
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetPenMode(IntPtr pen, int penMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetPenMode' -Namespace Win32 -PassThru
# $api::GdipSetPenMode(pen, penMode)
#uselib "gdiplus.dll"
#func global GdipSetPenMode "GdipSetPenMode" sptr, sptr
; GdipSetPenMode varptr(pen), penMode   ; 戻り値は stat
; pen : GpPen* in/out -> "sptr"
; penMode : PenAlignment -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipSetPenMode "GdipSetPenMode" var, int
; res = GdipSetPenMode(pen, penMode)
; pen : GpPen* in/out -> "var"
; penMode : PenAlignment -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipSetPenMode(GpPen* pen, PenAlignment penMode)
#uselib "gdiplus.dll"
#cfunc global GdipSetPenMode "GdipSetPenMode" var, int
; res = GdipSetPenMode(pen, penMode)
; pen : GpPen* in/out -> "var"
; penMode : PenAlignment -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetPenMode = gdiplus.NewProc("GdipSetPenMode")
)

// pen (GpPen* in/out), penMode (PenAlignment)
r1, _, err := procGdipSetPenMode.Call(
	uintptr(pen),
	uintptr(penMode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipSetPenMode(
  pen: Pointer;   // GpPen* in/out
  penMode: Integer   // PenAlignment
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetPenMode';
result := DllCall("gdiplus\GdipSetPenMode"
    , "Ptr", pen   ; GpPen* in/out
    , "Int", penMode   ; PenAlignment
    , "Int")   ; return: Status
●GdipSetPenMode(pen, penMode) = DLL("gdiplus.dll", "int GdipSetPenMode(void*, int)")
# 呼び出し: GdipSetPenMode(pen, penMode)
# pen : GpPen* in/out -> "void*"
# penMode : PenAlignment -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。