Win32 API 日本語リファレンス
ホームUI.Controls.RichEdit › PARAFORMAT2

PARAFORMAT2

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

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

フィールド

フィールドサイズx64x86説明
BasePARAFORMAT156+0+0PARAFORMATを継承する基底部。共通の段落書式を保持する。
dySpaceBeforeINT4+156+156段落前の余白(行間)をtwips単位で指定する。
dySpaceAfterINT4+160+160段落後の余白をtwips単位で指定する。
dyLineSpacingINT4+164+164行間の値を指定する。解釈はbLineSpacingRuleに依存する。
sStyleSHORT2+168+168段落に適用するスタイルハンドルを指定する。
bLineSpacingRuleBYTE1+170+170行間の計算規則を示す。0〜5の値で倍数や固定値を指定する。
bOutlineLevelBYTE1+171+171段落のアウトラインレベルを指定する。見出し階層に用いる。
wShadingWeightWORD2+172+172網掛けの濃度をパーセントで指定する。
wShadingStylePARAFORMAT_SHADING_STYLE2+174+174網掛けのパターンスタイルを指定する。
wNumberingStartWORD2+176+176番号付けの開始番号を指定する。
wNumberingStylePARAFORMAT_NUMBERING_STYLE2+178+178番号の表示スタイル(括弧やピリオド等)を指定する。
wNumberingTabWORD2+180+180番号と本文の間隔をtwips単位で指定する。
wBorderSpaceWORD2+182+182罫線と本文の間隔を指定する。
wBorderWidthWORD2+184+184罫線の太さを指定する。
wBordersPARAFORMAT_BORDERS2+186+186罫線を表示する辺を示すフラグである。

各言語での定義

#include <windows.h>

// PARAFORMAT  (x64 156 / x86 156 バイト)
typedef struct PARAFORMAT {
    DWORD cbSize;
    PARAFORMAT_MASK dwMask;
    PARAFORMAT_NUMBERING wNumbering;
    _Anonymous_e__Union Anonymous;
    INT dxStartIndent;
    INT dxRightIndent;
    INT dxOffset;
    PARAFORMAT_ALIGNMENT wAlignment;
    SHORT cTabCount;
    DWORD rgxTabs[32];
} PARAFORMAT;

// PARAFORMAT2  (x64 188 / x86 188 バイト)
typedef struct PARAFORMAT2 {
    PARAFORMAT Base;
    INT dySpaceBefore;
    INT dySpaceAfter;
    INT dyLineSpacing;
    SHORT sStyle;
    BYTE bLineSpacingRule;
    BYTE bOutlineLevel;
    WORD wShadingWeight;
    PARAFORMAT_SHADING_STYLE wShadingStyle;
    WORD wNumberingStart;
    PARAFORMAT_NUMBERING_STYLE wNumberingStyle;
    WORD wNumberingTab;
    WORD wBorderSpace;
    WORD wBorderWidth;
    PARAFORMAT_BORDERS wBorders;
} PARAFORMAT2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PARAFORMAT
{
    public uint cbSize;
    public uint dwMask;
    public ushort wNumbering;
    public _Anonymous_e__Union Anonymous;
    public int dxStartIndent;
    public int dxRightIndent;
    public int dxOffset;
    public ushort wAlignment;
    public short cTabCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public uint[] rgxTabs;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PARAFORMAT2
{
    public PARAFORMAT Base;
    public int dySpaceBefore;
    public int dySpaceAfter;
    public int dyLineSpacing;
    public short sStyle;
    public byte bLineSpacingRule;
    public byte bOutlineLevel;
    public ushort wShadingWeight;
    public ushort wShadingStyle;
    public ushort wNumberingStart;
    public ushort wNumberingStyle;
    public ushort wNumberingTab;
    public ushort wBorderSpace;
    public ushort wBorderWidth;
    public ushort wBorders;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PARAFORMAT
    Public cbSize As UInteger
    Public dwMask As UInteger
    Public wNumbering As UShort
    Public Anonymous As _Anonymous_e__Union
    Public dxStartIndent As Integer
    Public dxRightIndent As Integer
    Public dxOffset As Integer
    Public wAlignment As UShort
    Public cTabCount As Short
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public rgxTabs() As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PARAFORMAT2
    Public Base As PARAFORMAT
    Public dySpaceBefore As Integer
    Public dySpaceAfter As Integer
    Public dyLineSpacing As Integer
    Public sStyle As Short
    Public bLineSpacingRule As Byte
    Public bOutlineLevel As Byte
    Public wShadingWeight As UShort
    Public wShadingStyle As UShort
    Public wNumberingStart As UShort
    Public wNumberingStyle As UShort
    Public wNumberingTab As UShort
    Public wBorderSpace As UShort
    Public wBorderWidth As UShort
    Public wBorders As UShort
End Structure
import ctypes
from ctypes import wintypes

class PARAFORMAT(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("dwMask", wintypes.DWORD),
        ("wNumbering", ctypes.c_ushort),
        ("Anonymous", _Anonymous_e__Union),
        ("dxStartIndent", ctypes.c_int),
        ("dxRightIndent", ctypes.c_int),
        ("dxOffset", ctypes.c_int),
        ("wAlignment", ctypes.c_ushort),
        ("cTabCount", ctypes.c_short),
        ("rgxTabs", wintypes.DWORD * 32),
    ]

class PARAFORMAT2(ctypes.Structure):
    _fields_ = [
        ("Base", PARAFORMAT),
        ("dySpaceBefore", ctypes.c_int),
        ("dySpaceAfter", ctypes.c_int),
        ("dyLineSpacing", ctypes.c_int),
        ("sStyle", ctypes.c_short),
        ("bLineSpacingRule", ctypes.c_ubyte),
        ("bOutlineLevel", ctypes.c_ubyte),
        ("wShadingWeight", ctypes.c_ushort),
        ("wShadingStyle", ctypes.c_ushort),
        ("wNumberingStart", ctypes.c_ushort),
        ("wNumberingStyle", ctypes.c_ushort),
        ("wNumberingTab", ctypes.c_ushort),
        ("wBorderSpace", ctypes.c_ushort),
        ("wBorderWidth", ctypes.c_ushort),
        ("wBorders", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct PARAFORMAT {
    pub cbSize: u32,
    pub dwMask: u32,
    pub wNumbering: u16,
    pub Anonymous: _Anonymous_e__Union,
    pub dxStartIndent: i32,
    pub dxRightIndent: i32,
    pub dxOffset: i32,
    pub wAlignment: u16,
    pub cTabCount: i16,
    pub rgxTabs: [u32; 32],
}

#[repr(C)]
pub struct PARAFORMAT2 {
    pub Base: PARAFORMAT,
    pub dySpaceBefore: i32,
    pub dySpaceAfter: i32,
    pub dyLineSpacing: i32,
    pub sStyle: i16,
    pub bLineSpacingRule: u8,
    pub bOutlineLevel: u8,
    pub wShadingWeight: u16,
    pub wShadingStyle: u16,
    pub wNumberingStart: u16,
    pub wNumberingStyle: u16,
    pub wNumberingTab: u16,
    pub wBorderSpace: u16,
    pub wBorderWidth: u16,
    pub wBorders: u16,
}
import "golang.org/x/sys/windows"

type PARAFORMAT struct {
	cbSize uint32
	dwMask uint32
	wNumbering uint16
	Anonymous _Anonymous_e__Union
	dxStartIndent int32
	dxRightIndent int32
	dxOffset int32
	wAlignment uint16
	cTabCount int16
	rgxTabs [32]uint32
}

type PARAFORMAT2 struct {
	Base PARAFORMAT
	dySpaceBefore int32
	dySpaceAfter int32
	dyLineSpacing int32
	sStyle int16
	bLineSpacingRule byte
	bOutlineLevel byte
	wShadingWeight uint16
	wShadingStyle uint16
	wNumberingStart uint16
	wNumberingStyle uint16
	wNumberingTab uint16
	wBorderSpace uint16
	wBorderWidth uint16
	wBorders uint16
}
type
  PARAFORMAT = record
    cbSize: DWORD;
    dwMask: DWORD;
    wNumbering: Word;
    Anonymous: _Anonymous_e__Union;
    dxStartIndent: Integer;
    dxRightIndent: Integer;
    dxOffset: Integer;
    wAlignment: Word;
    cTabCount: Smallint;
    rgxTabs: array[0..31] of DWORD;
  end;

  PARAFORMAT2 = record
    Base: PARAFORMAT;
    dySpaceBefore: Integer;
    dySpaceAfter: Integer;
    dyLineSpacing: Integer;
    sStyle: Smallint;
    bLineSpacingRule: Byte;
    bOutlineLevel: Byte;
    wShadingWeight: Word;
    wShadingStyle: Word;
    wNumberingStart: Word;
    wNumberingStyle: Word;
    wNumberingTab: Word;
    wBorderSpace: Word;
    wBorderWidth: Word;
    wBorders: Word;
  end;
const PARAFORMAT = extern struct {
    cbSize: u32,
    dwMask: u32,
    wNumbering: u16,
    Anonymous: _Anonymous_e__Union,
    dxStartIndent: i32,
    dxRightIndent: i32,
    dxOffset: i32,
    wAlignment: u16,
    cTabCount: i16,
    rgxTabs: [32]u32,
};

const PARAFORMAT2 = extern struct {
    Base: PARAFORMAT,
    dySpaceBefore: i32,
    dySpaceAfter: i32,
    dyLineSpacing: i32,
    sStyle: i16,
    bLineSpacingRule: u8,
    bOutlineLevel: u8,
    wShadingWeight: u16,
    wShadingStyle: u16,
    wNumberingStart: u16,
    wNumberingStyle: u16,
    wNumberingTab: u16,
    wBorderSpace: u16,
    wBorderWidth: u16,
    wBorders: u16,
};
type
  PARAFORMAT {.bycopy.} = object
    cbSize: uint32
    dwMask: uint32
    wNumbering: uint16
    Anonymous: _Anonymous_e__Union
    dxStartIndent: int32
    dxRightIndent: int32
    dxOffset: int32
    wAlignment: uint16
    cTabCount: int16
    rgxTabs: array[32, uint32]

  PARAFORMAT2 {.bycopy.} = object
    Base: PARAFORMAT
    dySpaceBefore: int32
    dySpaceAfter: int32
    dyLineSpacing: int32
    sStyle: int16
    bLineSpacingRule: uint8
    bOutlineLevel: uint8
    wShadingWeight: uint16
    wShadingStyle: uint16
    wNumberingStart: uint16
    wNumberingStyle: uint16
    wNumberingTab: uint16
    wBorderSpace: uint16
    wBorderWidth: uint16
    wBorders: uint16
struct PARAFORMAT
{
    uint cbSize;
    uint dwMask;
    ushort wNumbering;
    _Anonymous_e__Union Anonymous;
    int dxStartIndent;
    int dxRightIndent;
    int dxOffset;
    ushort wAlignment;
    short cTabCount;
    uint[32] rgxTabs;
}

struct PARAFORMAT2
{
    PARAFORMAT Base;
    int dySpaceBefore;
    int dySpaceAfter;
    int dyLineSpacing;
    short sStyle;
    ubyte bLineSpacingRule;
    ubyte bOutlineLevel;
    ushort wShadingWeight;
    ushort wShadingStyle;
    ushort wNumberingStart;
    ushort wNumberingStyle;
    ushort wNumberingTab;
    ushort wBorderSpace;
    ushort wBorderWidth;
    ushort wBorders;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PARAFORMAT2 サイズ: 188 バイト(x64)
dim st, 47    ; 4byte整数×47(構造体サイズ 188 / 4 切り上げ)
; Base : PARAFORMAT (+0, 156byte)  varptr(st)+0 を基点に操作(156byte:入れ子/配列)
; dySpaceBefore : INT (+156, 4byte)  st.39 = 値  /  値 = st.39   (lpoke/lpeek も可)
; dySpaceAfter : INT (+160, 4byte)  st.40 = 値  /  値 = st.40   (lpoke/lpeek も可)
; dyLineSpacing : INT (+164, 4byte)  st.41 = 値  /  値 = st.41   (lpoke/lpeek も可)
; sStyle : SHORT (+168, 2byte)  wpoke st,168,値  /  値 = wpeek(st,168)
; bLineSpacingRule : BYTE (+170, 1byte)  poke st,170,値  /  値 = peek(st,170)
; bOutlineLevel : BYTE (+171, 1byte)  poke st,171,値  /  値 = peek(st,171)
; wShadingWeight : WORD (+172, 2byte)  wpoke st,172,値  /  値 = wpeek(st,172)
; wShadingStyle : PARAFORMAT_SHADING_STYLE (+174, 2byte)  wpoke st,174,値  /  値 = wpeek(st,174)
; wNumberingStart : WORD (+176, 2byte)  wpoke st,176,値  /  値 = wpeek(st,176)
; wNumberingStyle : PARAFORMAT_NUMBERING_STYLE (+178, 2byte)  wpoke st,178,値  /  値 = wpeek(st,178)
; wNumberingTab : WORD (+180, 2byte)  wpoke st,180,値  /  値 = wpeek(st,180)
; wBorderSpace : WORD (+182, 2byte)  wpoke st,182,値  /  値 = wpeek(st,182)
; wBorderWidth : WORD (+184, 2byte)  wpoke st,184,値  /  値 = wpeek(st,184)
; wBorders : PARAFORMAT_BORDERS (+186, 2byte)  wpoke st,186,値  /  値 = wpeek(st,186)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PARAFORMAT
    #field int cbSize
    #field int dwMask
    #field short wNumbering
    #field byte Anonymous 2
    #field int dxStartIndent
    #field int dxRightIndent
    #field int dxOffset
    #field short wAlignment
    #field short cTabCount
    #field int rgxTabs 32
#endstruct

#defstruct global PARAFORMAT2
    #field PARAFORMAT Base
    #field int dySpaceBefore
    #field int dySpaceAfter
    #field int dyLineSpacing
    #field short sStyle
    #field byte bLineSpacingRule
    #field byte bOutlineLevel
    #field short wShadingWeight
    #field short wShadingStyle
    #field short wNumberingStart
    #field short wNumberingStyle
    #field short wNumberingTab
    #field short wBorderSpace
    #field short wBorderWidth
    #field short wBorders
#endstruct

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