If you are unhappy with the standard font style and color in the log, they can be changed with the help of the log's attributes. In this recipe, we will deal with outputting the message with changed parameters for the font.
To post a message with a different style perform the following steps:
Log.CreateNewAttributes
method and change the following parameters: Bold
, FontColor
, and BackColor
in the following manner:var attrBoldBlue = Log.CreateNewAttributes(); attrBoldBlue.Bold = true; attrBoldBlue.FontColor = clWhite; attrBoldBlue.BackColor = clBlue;
Log.Message
and, with the fourth parameter, we will pass the created variable of attrBoldBlue
to it:Log.Message("Customized message", null, pmNormal, attrBoldBlue);
In the result, the message will get outputted into the log as follows:
With the help of the attributes, we can change the color of the fonts and the background (the properties FontColor
and BackColor
) and the text decoration (Bold
, Italic
, Underline
, and StrikeOut
).
In TestComplete, there is a set of supported standard font colors (such as clWhite
and clBlue
), which can be used as settings for the font and background color. Similarly, it is possible to change the text display style for other types of messages (errors, warnings, and so on) also.
18.191.189.186