Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Теория / Теория / ОСиСП ответы на некоторые вопросы.doc
Скачиваний:
81
Добавлен:
11.05.2015
Размер:
1.38 Mб
Скачать

Вопрос 14: Вывод текста. Логические и физические шрифты. Вывод текста.

Имеется несколько функций:

BOOL TextOut();

BOOL ExtTextOut();

BOOL TextOut();

Int DrawText();

LONG TabbedTextOut();

Параметры этих функций:

BOOL GrayString();

HDC hdc, // handle to DC

int nXStart, // x-coordinate of starting position

int nYStart, // y-coordinate of starting position

LPCTSTR lpString, // character string

int cbString // number of characters

);

BOOL ExtTextOut(

HDC hdc, // handle to DC

int X, // x-coordinate of reference point

int Y, // y-coordinate of reference point

UINT fuOptions, // text-output options

CONST RECT* lprc, // optional dimensions

LPCTSTR lpString, // string

UINT cbCount, // number of characters in string

CONST INT* lpDx // array of spacing values

);

Вывод текста в некоторой ячейке:

DrawText(

HDC hDC, // handle to DC

LPCTSTR lpString, // text to draw

int nCount, // text length

LPRECT lpRect, // formatting dimensions

UINT uFormat // text-drawing options

);

The TabbedTextOut function writes a character string at a specified location, expanding tabs to the values specified in an array of tab-stop positions. Text is written in the currently selected font, background color, and text color.

LONG TabbedTextOut(

HDC hDC, // handle to DC

int X, // x-coord of start

int Y, // y-coord of start

LPCTSTR lpString, // character string

int nCount, // number of characters

int nTabPositions, // number of tabs in array

CONST LPINT lpnTabStopPositions, // array of tab positions

int nTabOrigin // start of tab expansion

);

The GrayString function draws gray text at the specified location. The function draws the text by copying it into a memory bitmap, graying the bitmap, and then copying the bitmap to the screen. The function grays the text regardless of the selected brush and background. GrayString uses the font currently selected for the specified device context.

If the lpOutputFunc parameter is NULL, GDI uses the TextOut function, and the lpData parameter is assumed to be a pointer to the character string to be output. If the characters to be output cannot be handled by TextOut (for example, the string is stored as a bitmap), the application must supply its own output function.

BOOL GrayString(

HDC hDC, // handle to DC

HBRUSH hBrush, // handle to the brush

GRAYSTRINGPROC lpOutputFunc, // callback function

LPARAM lpData, // application-defined data

int nCount, // number of characters

int X, // horizontal position

int Y, // vertical position

int nWidth, // width

int nHeight // height

);

Функции WinAPI принимающие строковые параметры существуют в трех видах. <function> - она отображена на <function>A, <function>A – ANSI string, <function>W – Unicode.