ホーム › UI.Controls.RichEdit › CHARFORMATA
CHARFORMATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 |
| dwMask | CFM_MASK | 4 | +4 | +4 |
| dwEffects | CFE_EFFECTS | 4 | +8 | +8 |
| yHeight | INT | 4 | +12 | +12 |
| yOffset | INT | 4 | +16 | +16 |
| crTextColor | COLORREF | 4 | +20 | +20 |
| bCharSet | FONT_CHARSET | 1 | +24 | +24 |
| bPitchAndFamily | BYTE | 1 | +25 | +25 |
| szFaceName | CHAR | 32 | +26 | +26 |
各言語での定義
#include <windows.h>
// CHARFORMATA (x64 60 / x86 60 バイト)
typedef struct CHARFORMATA {
DWORD cbSize;
CFM_MASK dwMask;
CFE_EFFECTS dwEffects;
INT yHeight;
INT yOffset;
COLORREF crTextColor;
FONT_CHARSET bCharSet;
BYTE bPitchAndFamily;
CHAR szFaceName[32];
} CHARFORMATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CHARFORMATA
{
public uint cbSize;
public uint dwMask;
public uint dwEffects;
public int yHeight;
public int yOffset;
public uint crTextColor;
public byte bCharSet;
public byte bPitchAndFamily;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] szFaceName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CHARFORMATA
Public cbSize As UInteger
Public dwMask As UInteger
Public dwEffects As UInteger
Public yHeight As Integer
Public yOffset As Integer
Public crTextColor As UInteger
Public bCharSet As Byte
Public bPitchAndFamily As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public szFaceName() As SByte
End Structureimport ctypes
from ctypes import wintypes
class CHARFORMATA(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwMask", wintypes.DWORD),
("dwEffects", wintypes.DWORD),
("yHeight", ctypes.c_int),
("yOffset", ctypes.c_int),
("crTextColor", wintypes.DWORD),
("bCharSet", ctypes.c_ubyte),
("bPitchAndFamily", ctypes.c_ubyte),
("szFaceName", ctypes.c_byte * 32),
]#[repr(C)]
pub struct CHARFORMATA {
pub cbSize: u32,
pub dwMask: u32,
pub dwEffects: u32,
pub yHeight: i32,
pub yOffset: i32,
pub crTextColor: u32,
pub bCharSet: u8,
pub bPitchAndFamily: u8,
pub szFaceName: [i8; 32],
}import "golang.org/x/sys/windows"
type CHARFORMATA struct {
cbSize uint32
dwMask uint32
dwEffects uint32
yHeight int32
yOffset int32
crTextColor uint32
bCharSet byte
bPitchAndFamily byte
szFaceName [32]int8
}type
CHARFORMATA = record
cbSize: DWORD;
dwMask: DWORD;
dwEffects: DWORD;
yHeight: Integer;
yOffset: Integer;
crTextColor: DWORD;
bCharSet: Byte;
bPitchAndFamily: Byte;
szFaceName: array[0..31] of Shortint;
end;const CHARFORMATA = extern struct {
cbSize: u32,
dwMask: u32,
dwEffects: u32,
yHeight: i32,
yOffset: i32,
crTextColor: u32,
bCharSet: u8,
bPitchAndFamily: u8,
szFaceName: [32]i8,
};type
CHARFORMATA {.bycopy.} = object
cbSize: uint32
dwMask: uint32
dwEffects: uint32
yHeight: int32
yOffset: int32
crTextColor: uint32
bCharSet: uint8
bPitchAndFamily: uint8
szFaceName: array[32, int8]struct CHARFORMATA
{
uint cbSize;
uint dwMask;
uint dwEffects;
int yHeight;
int yOffset;
uint crTextColor;
ubyte bCharSet;
ubyte bPitchAndFamily;
byte[32] szFaceName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CHARFORMATA サイズ: 60 バイト(x64)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMask : CFM_MASK (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwEffects : CFE_EFFECTS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; yHeight : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; yOffset : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; crTextColor : COLORREF (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; bCharSet : FONT_CHARSET (+24, 1byte) poke st,24,値 / 値 = peek(st,24)
; bPitchAndFamily : BYTE (+25, 1byte) poke st,25,値 / 値 = peek(st,25)
; szFaceName : CHAR (+26, 32byte) varptr(st)+26 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CHARFORMATA
#field int cbSize
#field int dwMask
#field int dwEffects
#field int yHeight
#field int yOffset
#field int crTextColor
#field byte bCharSet
#field byte bPitchAndFamily
#field byte szFaceName 32
#endstruct
stdim st, CHARFORMATA ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize