ImageWindow::SetTextStyle

Sets style of a string to be drawn in the Image Display window

int SetTextStyle(
   int  size,
   int  align,
   int  colorKind,
   int  angle,
   int  style
);

int SetTextStyle(
   int  size,
   int  align,
   COLORREF     color,
   int  angle,
   int  style
);

int SetTextStyle(
   int  size,
   int  align,
   int  colorKind,
   int  angle,
   int  style,
   COLORREF     backgroundColor
);

int SetTextStyle(
   int  size,
   int  align,
   COLORREF     color,
   int  angle,
   int  style,
   COLORREF     backgroundColor
);

Parameters
*size
Font size to draw
Specify FONTSIZE_NORMAL for the normal size.
To display the double size font, specify FONTSIZE_NORMAL*2.
align
Arrangement specification of the string to be drawn.
You can specify multiple values by using OR (※Table1)
colorKind
Color of the figure to be drawn.
1 (JUDGE_OK): OK color
-1 (JUDGE_NG): NG color
0 (JUDGE_NC): Gray
color
Color of the string to be drawn
angle
Tilt of the string to be drawn
style
Typeface of the string to be drawn (※Table2)
backgroundColor
Color of the background to be drawn
1 (JUDGE_OK): OK color
-1 (JUDGE_NG): NG color
0 (JUDGE_NC): Gray
Table1: ImageWindow::SetTextStyle - Parameters
Value
Description
TA_TOP
Sets the text display coordinate at the top
TA_BOTTOM
Sets the text display coordinate at the bottom
TA_LEFT
Sets the text display coordinate at the left end
TA_CENTER
Sets the text display coordinate at the center (horizontal)
TA_RIGHT
Sets the text display coordinate at the right end
Table2: ImageWindow::SetTextStyle - Parameters
Value
Description
FONTSTYLE_NORMAL
Normal text
FONTSTYLE_BOLD
Bold text
FONTSTYLE_ITALIC
Italic text
FONTSTYLE_UNDERLINE
Underlined text
FONTSTYLE_STRIKEOUT
Strikethroughed text

Return Value
Returns 0 when the draw style of the string is successfully set.
Otherwise returns a non-zero value.

Description
Sets the draw style of the string to be displayed in the Image Display window.
The style which is set with SetTextStyle() method is only enabled when the string is displayed by using DrawText() method (see "refImageWindow::DrawText").

Example
    int Sample::MeasureDispT(ProcUnit *ptrProcUnit, int subNo, ImageWindow *ptrImageWindow)
    {
        FIG_HEADER *figure;

        // Set the style of the string to be drawn

        SetTextStyle(FONTSIZE_NORMAL, TA_TOP | TA_LEFT,ptrProcUnit->GetUnitJudge(), 0, FONTSTYLE_NORMAL);

        // Display a string

        ptrImageWindow->DrawText(100, 200, _T("Test"));

        // Set the style of the string to be drawn

        ptrImageWindow->SetTextStyle(FONTSIZE_NORMAL,TA_TOP | TA_CENTER, RGB(255, 0, 0), 0, FONTSTYLE_NORMAL);

        // Display a string

        ptrImageWindow->DrawText(100, 300, _T("Test 2"));

        // Set the style of the string to be drawn

        SetTextStyle(FONTSIZE_NORMAL, TA_TOP | TA_LEFT,ptrProcUnit->GetUnitJudge(), 0, FONTSTYLE_NORMAL, RGB(0, 255, 0));

        // Display a string

        ptrImageWindow->DrawText(300, 200, _T("Test 3"));

        // Set the style of the string to be drawn

        ptrImageWindow->SetTextStyle(FONTSIZE_NORMAL,TA_TOP | TA_CENTER, RGB(255, 0, 0), 0, FONTSTYLE_NORMAL, RGB(0, 255, 0));

        // Display a string

        ptrImageWindow->DrawText(300, 300, _T("Test 4"));
    }