PARAFORMAT2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Base | PARAFORMAT | 156 | +0 | +0 | PARAFORMATを継承する基底部。共通の段落書式を保持する。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dySpaceBefore | INT | 4 | +156 | +156 | 段落の上側の間隔のサイズ (twip 単位)。このメンバーを使用するには、 dwMask メンバーに PFM_SPACEBEFORE フラグを設定します。値は 0 以上でなければなりません。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dySpaceAfter | INT | 4 | +160 | +160 | 段落の下側の間隔のサイズを twip 単位で指定します。このメンバーを使用するには、 dwMask メンバーに PFM_SPACEAFTER フラグを設定します。値は 0 以上でなければなりません。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dyLineSpacing | INT | 4 | +164 | +164 | 行間。この値がどのように解釈されるかについては、 bLineSpacingRule メンバーの説明を参照してください。このメンバーを使用するには、 dwMask メンバーに PFM_LINESPACING フラグを設定します。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sStyle | SHORT | 2 | +168 | +168 | テキストのスタイル。このメンバーを使用するには、 dwMask メンバーに PFM_STYLE フラグを設定します。このメンバーは TOM インターフェイスおよび Word との互換性のためだけに用意されています。リッチエディットコントロールは値を保持しますが、テキストの表示には使用しません。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bLineSpacingRule | BYTE | 1 | +170 | +170 | 行間の種類。このメンバーを使用するには、 dwMask メンバーに PFM_LINESPACING フラグを設定します。このメンバーには次のいずれかの値を指定できます。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bOutlineLevel | BYTE | 1 | +171 | +171 | 予約済みです。0 でなければなりません。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wShadingWeight | WORD | 2 | +172 | +172 | 網かけに使用される前景色の割合 (パーセント)。 wShadingStyle メンバーが網かけの前景色と背景色を指定します。値 5 は、前景色 5 パーセントと背景色 95 パーセントから成る網かけ色を示します。これらのメンバーを使用するには、 dwMask メンバーに PFM_SHADING フラグを設定します。このメンバーは Word との互換性のためだけに用意されています。リッチエディットコントロールは値を保持しますが、テキストの表示には使用しません。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wShadingStyle | PARAFORMAT_SHADING_STYLE | 2 | +174 | +174 | 背景の網かけに使用されるスタイルと色。ビット 0 ~ 3 に網かけスタイル、ビット 4 ~ 7 に前景色インデックス、ビット 8 ~ 11 に背景色インデックスが格納されます。このメンバーを使用するには、 dwMask メンバーに PFM_SHADING フラグを設定します。このメンバーは Word との互換性のためだけに用意されています。リッチエディットコントロールは値を保持しますが、テキストの表示には使用しません。 網かけスタイルには次のいずれかの値を指定できます。
前景色と背景色のインデックスには次のいずれかの値を指定できます。
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wNumberingStart | WORD | 2 | +176 | +176 | 番号付き段落に使用される開始番号または Unicode 値。このメンバーは wNumbering メンバーと組み合わせて使用します。このメンバーは TOM インターフェイスとの互換性のためだけに用意されています。リッチエディットコントロールは値を保持しますが、テキストや行頭文字の表示には使用しません。このメンバーを使用するには、 dwMask メンバーに PFM_NUMBERINGSTART フラグを設定します。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wNumberingStyle | PARAFORMAT_NUMBERING_STYLE | 2 | +178 | +178 | 番号付き段落で使用される番号のスタイル。このメンバーは wNumbering メンバーと組み合わせて使用します。このメンバーは TOM インターフェイスとの互換性のためだけに用意されています。リッチエディットコントロールは値を保持しますが、3.0 より前のバージョンではテキストや行頭文字の表示には使用しません。このメンバーを使用するには、 dwMask メンバーに PFM_NUMBERINGSTYLE フラグを設定します。このメンバーには次のいずれかの値を指定できます。
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wNumberingTab | WORD | 2 | +180 | +180 | 段落番号と段落テキストの間の最小の間隔 (twip 単位)。このメンバーは wNumbering メンバーと組み合わせて使用します。 wNumberingTab メンバーは TOM インターフェイスとの互換性のために用意されています。Microsoft Rich Edit 3.0 より前では、リッチエディットコントロールは値を保持しますが、テキストの表示には使用しません。このメンバーを使用するには、 dwMask メンバーに PFM_NUMBERINGTAB フラグを設定します。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wBorderSpace | WORD | 2 | +182 | +182 | 罫線と段落テキストの間の間隔 (twip 単位)。 wBorderSpace メンバーは Word との互換性のために用意されています。リッチエディットコントロールは値を保持しますが、テキストの表示には使用しません。このメンバーを使用するには、 dwMask メンバーに PFM_BORDER フラグを設定します。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wBorderWidth | WORD | 2 | +184 | +184 | 罫線の幅 (twip 単位)。このメンバーを使用するには、 dwMask メンバーに PFM_BORDER フラグを設定します。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wBorders | PARAFORMAT_BORDERS | 2 | +186 | +186 | 罫線の位置、スタイル、および色。ビット 0 ~ 7 で罫線の位置、ビット 8 ~ 11 で罫線のスタイル、ビット 12 ~ 15 で罫線の色インデックスを指定します。このメンバーを使用するには、 dwMask メンバーに PFM_BORDER フラグを設定します。 罫線の位置は、ビット 0 ~ 7 に次の値の組み合わせを指定します。
罫線のスタイルは、ビット 8 ~ 11 に次のいずれかの値を指定します。
罫線の色は、ビット 12 ~ 15 に次のいずれかの値を指定します。自動色のビット (ビット 6) が設定されている場合、この値は無視されます。
|
公式ドキュメント
リッチエディットコントロールの段落書式属性に関する情報を格納します。PARAFORMAT2 は、PARAFORMAT 構造体を Microsoft Rich Edit 2.0 で拡張したものです。Microsoft Rich Edit 2.0 では、EM_GETPARAFORMAT メッセージおよび EM_SETPARAFORMAT メッセージでどちらの構造体も使用できます。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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 Structureimport 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: uint16struct 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