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

LOGBRUSH32

構造体
サイズx64: 12 バイト / x86: 12 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
lbStyleBRUSH_STYLE4+0+0ブラシのスタイル(塗りつぶし/ハッチ等)を示すBRUSH_STYLE。
lbColorCOLORREF4+4+4ブラシの色を表すCOLORREF値。
lbHatchDWORD4+8+8ハッチパターンの種別、またはスタイルに応じた追加データ(32ビット)。

各言語での定義

#include <windows.h>

// LOGBRUSH32  (x64 12 / x86 12 バイト)
typedef struct LOGBRUSH32 {
    BRUSH_STYLE lbStyle;
    COLORREF lbColor;
    DWORD lbHatch;
} LOGBRUSH32;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LOGBRUSH32
{
    public uint lbStyle;
    public uint lbColor;
    public uint lbHatch;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LOGBRUSH32
    Public lbStyle As UInteger
    Public lbColor As UInteger
    Public lbHatch As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LOGBRUSH32(ctypes.Structure):
    _fields_ = [
        ("lbStyle", wintypes.DWORD),
        ("lbColor", wintypes.DWORD),
        ("lbHatch", wintypes.DWORD),
    ]
#[repr(C)]
pub struct LOGBRUSH32 {
    pub lbStyle: u32,
    pub lbColor: u32,
    pub lbHatch: u32,
}
import "golang.org/x/sys/windows"

type LOGBRUSH32 struct {
	lbStyle uint32
	lbColor uint32
	lbHatch uint32
}
type
  LOGBRUSH32 = record
    lbStyle: DWORD;
    lbColor: DWORD;
    lbHatch: DWORD;
  end;
const LOGBRUSH32 = extern struct {
    lbStyle: u32,
    lbColor: u32,
    lbHatch: u32,
};
type
  LOGBRUSH32 {.bycopy.} = object
    lbStyle: uint32
    lbColor: uint32
    lbHatch: uint32
struct LOGBRUSH32
{
    uint lbStyle;
    uint lbColor;
    uint lbHatch;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LOGBRUSH32 サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; lbStyle : BRUSH_STYLE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; lbColor : COLORREF (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lbHatch : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LOGBRUSH32
    #field int lbStyle
    #field int lbColor
    #field int lbHatch
#endstruct

stdim st, LOGBRUSH32        ; NSTRUCT 変数を確保
st->lbStyle = 100
mes "lbStyle=" + st->lbStyle