BOOL CBCGPEditCtrl::IsInBlock | ( | int | nPos, |
TCHAR | chOpen, | ||
TCHAR | chClose, | ||
int & | nBlockStart, | ||
int & | nBlockEnd | ||
) |
Determines whether the specifies offset is located between two characters.
You can use this function for advanced block coloring in conjunction with overridden OnGetCharColor(). For example, if you want to implement HTML syntax highlighting, you can override OnGetCharColor() and every time call
IsInBlock(nCurrPos, "<", ">", nBlockStart, nBlockFinish).
Note. When implementing this algorithm you should be aware of performance issues, because IsInBlock implements simple text scanning in both directions from the specified offset. It may be non-efficient for large blocks.
nPos | Position to check. |
chOpen | Opening block character. |
chClose | Closing block character. |
nBlockStart | [out] When the function returns contains the zero-based offset of chOpen from the beginning of the text. |
nBlockEnd | [out] When the function returns contains the zero-based offset of chClose from the beginning of the text. |