ExtTextOut - 扩展的文本输出;
win32 api的声明如下;
ExtTextOut(
DC: HDC; {设备环境句柄}
X, Y: Integer; {起点坐标}
Options: Longint; {选项}
Rect: PRect; {指定显示范围; 0 表示限制范围}
Str: PChar; {字符串指针}
Count: Longint; {字符串长度}
Dx: PInteger {表示字符间距的数组; 是可选值}
): BOOL;
//Options 参数可选值:
ETO_OPAQUE = 2; {输出前, 用当前背景色填充矩形}
ETO_CLIPPED = 4; {剪切输出, 只输出矩形范围内的文本}
ETO_GLYPH_INDEX = 10;
ETO_RTLREADING = 80;
ETO_NUMERICSLOCAL = 400;
ETO_NUMERICSLATIN = 800;
ETO_IGNORELANGUAGE = 1000;
ETO_PDY = 2000;
VC6新建一个单文档工程;
void CExtView::OnDraw(CDC* pDC)
{
CExtDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rect1(10,10,250,200);
CString str1 = "Delphi";
int iArray[] = {10,20,30,40,50};
int iArray2[] = {10,30,50,70,90};
pDC->ExtTextOut(50, 50, ETO_CLIPPED, rect1, str1, 6, iArray);
pDC->ExtTextOut(50, 80, ETO_CLIPPED, rect1, str1, 6, iArray2);
}
看一下输出一个字符串时,通过一个字符间距数组的控制,实现了字符间距逐步扩大的输出;