BCGControlBar Pro for MFC
POSITION CBCGPEditCtrl::SetBlockColor ( CString  strBlockOpen,
CString  strBlockClose,
BOOL  bWholeText = FALSE,
COLORREF  clrFrgnd = (COLORREF)-1,
COLORREF  clrBkgnd = (COLORREF)-1,
BOOL  bCaseSensitive = FALSE,
BOOL  bWholeWord = FALSE 
)

Adds a new color block definition to the list of color block definitions.

Returns
A position of the newly added color block definition in the internal list of color block definitions (m_lstColorBlocks). It can be NULL and the function asserts in the following cases:
  • strBlockOpen or strBlockClose length exceeds _MAX_COLOR_BLOCK_STR_LEN (currently set to 4)
  • bWholeText is TRUE and strBlockOpen or strBlockClose is empty
  • bWholeText is TRUE and there is another color block definition with m_bWholeText set to TRUE.

An example of color block can be the C++ comment definition: open block - /*, close block - */, bWholeText - TRUE (meaning that this block may take several lines).

Because of nested blocks problems you can't define more than one block with bWholeText set to TRUE (it can't be more than one multiline block).

You can use the returned value for calling on RemoveBlockColor.

Parameters
strBlockOpenSpecifies the opening block pattern.
strBlockCloseSpecifies the closing block pattern. Can be empty for single line blocks (like // in C++).
bWholeTextIf TRUE, the block is multiline. If FALSE, the block is single line.
clrFrgndSpecifies the block foreground color.
clrBkgndSpecifies the block background color.
bCaseSensitiveIf TRUE, the editor syntax highlighting for this block will be case sensitive.
bWholeWordIf TRUE, the function looks for the exact word.